def count

bend-collections-laws-math@1.0.0.0 · spec/math/random/rand.bend:84

import bend-collections-laws-math@1.0.0.0/spec/math/random/rand.bend as Rand
import Base

84# the number of source outputs x < N that draw k
85def count(+w: Nat, +n: Nat, +k: Nat, N: Nat) -> Nat:
86  match N:
87    case 0n:
88      0n
89    case 1n+ +x:
90      Nat.add(count(w, n, k, x), hit(draw(w, x, n), k))

Uses (4)

Used by (6)