def uint64n

bend-collections@1.0.0.0 · src/math/random/rand.bend:166

import bend-collections@1.0.0.0/src/math/random/rand.bend as Rand
import Base
import bend-collections@1.0.0.0/src/math/u64.bend as W

166# uniform in [0, n) for n > 0 (Go's Uint64N)
167def uint64n(~S: Data, ~next: S -> W.U64 & S, s: S, +n: W.U64) -> W.U64 & S:
168  uint64n_pick(~S, ~next, s, n, is_pow2(n))

Uses (4)

Used by (7)