Rand.lemire_small: def of bend-collections@1.0.0.0 Import: import bend-collections@1.0.0.0/src/math/random/rand.bend as Rand Lines 145-152 of bend-collections@1.0.0.0/src/math/random/rand.bend: https://jend.leeeet.dev/read.txt?path=bend-collections@1.0.0.0/src/math/random/rand.bend&start_line=145&end_line=152 import Base import bend-collections@1.0.0.0/src/math/u64.bend as W # lo >= n >= t accepts at once; otherwise t = 2^64 mod n is computed and at # most 127 more draws are made def lemire_small(~S: Data, ~next: S -> W.U64 & S, +n: W.U64, +hi: W.U64, +lo: W.U64, s: S, small: Bool) -> W.U64 & S: match small: case False{}: (hi, s) case True{}: result(S, retry(~S, ~next, 127n, n, thresh(n), D{hi, lo, s})) Uses (8): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Pair https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Sigma https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/math/random/rand.bend&name=Draw https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/math/random/rand.bend&name=result https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/math/random/rand.bend&name=retry https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/math/random/rand.bend&name=thresh https://jend.leeeet.dev/definition.txt?path=bend-collections@1.0.0.0/src/math/u64.bend&name=U64