xorshift32
xorshift32(
seed):RandomFn
Defined in: xorshift32.ts:18
Creates a seeded pseudo-random number generator function using the xorshift32 algorithm by George Marsaglia (2003). 32-bit state, 32-bit output.
Note: Fails some PractRand tests at large sample sizes, so prefer sfc32/xoshiro128p for statistical work; fine for non-adversarial deterministic fixtures, and simple enough to reproduce bit-for-bit in another language (C, Python, Rust, …) when a fixture must match across an FFI or subprocess boundary.
Parameters
Section titled “Parameters”number
The seed value to initialize the 32-bit state. Must be nonzero (an all-zero state never changes).
Returns
Section titled “Returns”RandomFn
A function that generates pseudo-random numbers in the range [0, 1) when called.