def uint32n
import bend-collections@1.0.0.0/src/math/random/rand.bend as Randimport Base
import bend-collections@1.0.0.0/src/math/u64.bend as W
177# uniform in [0, n) for n > 0 (Go's Uint32N)
178def uint32n(~S: Data, ~next: S -> W.U64 & S, s: S, +n: U32) -> U32 & S:
179 lo32(S, uint64n(~S, ~next, s, W.U64{n, 0}))