def int_range

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

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

220# uniform in [lo, hi) for lo < hi, hi - lo < 2^48; (lo, s) when hi <= lo
221def int_range(~S: Data, ~next: S -> W.U64 & S, s: S, +lo: Nat, +hi: Nat) -> Nat & S:
222  plus(S, lo, intn(~S, ~next, s, Nat.sub(hi, lo)))

Uses (6)

Used by (1)