We show that complexity analysis of probabilistic higher-order functional programs can be carried out compositionally by way of a type system. The introduced type system is a significant extension of refinement types. On the one hand, the presence of probabilistic effects requires adopting a form of dynamic distribution type, subject to a coupling-based subtyping discipline. On the other hand, recursive definitions are proved terminating by way of Lyapunov ranking functions. We prove not only that the obtained type system, called RPCF, provides a sound methodology for average case complexity analysis, but also that it is extensionally complete, in the sense that any average case polytime Turing machines can be encoded as a term typable in RPCF. ∀l : L K J (l).∀n : n ≤ K ∧ notElem(n, l). Nat(n) ⊗ List(l) List(g | L K CntLe(l,n) (g)) ⊗ List(g | L K CntGt(l,n) (g)) (a) Type of partition. ∀l : L K J+1 (l). List(l) 1 J+1 : List(g | L K CntLe(l,Nth(l,i)) (g)) ⊗ Nat(b | b ≤ K) ⊗ List(g | L K CntGt(l,Nth(l,i)) (g)) | i ≤ J (b) Type of ppartition. List(l | L K J+1 (l)). 1 J+1 : List(g | L K c (g)) ⊗ Nat(b | b ≤ K) ⊗ List(g | L K J−c (g)) | c ≤ J (c) Subtype of type ppartition.