def uniform

bend-ml-llama@0.2.1.0 · main.bend:1128

import bend-ml-llama@0.2.1.0/main.bend as BendMlLlama
import Base

1128# draw n of a seed, a uniform F32 in [0, 1): the top 24 bits of hash32(hash32(seed) + n), times 2^-24 (exact). Nothing
1129# is kept between draws, so a seed gives the same draws whatever ran before.
1130def uniform(+seed: U32, +n: U32) -> F32:
1131  F32.mul(U32.to_f32(U32.shrn(hash32(U32.add(hash32(seed), n)), 8n)), 5.9604644775390625e-8)

Uses (7)

Used by (0)

No other definition uses this definition.