code wiki / (root) / nx_xoshiro.nx

nx_xoshiro.nx

buildroot/runtime/nx_xoshiro.nx

3725 B114 linesdepth 4pulls 4 transitivereach 1 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

xoshiro.nx -- xoshiro256++ pseudorandom number generator. David Blackman + Sebastiano Vigna 2018. 256-bit state, 64-bit output per step, period 2^256 - 1. Passes BigCrush statistical tests. Used by: Rust `rand` standard generator, Lua 5.4, GNU FORTRAN, .NET 6+. NOT cryptographically secure -- an attacker who observes enough output can reconstruct state. For crypto use rand.nx (/dev/urandom) or HMAC-DRBG (pending). Used for: simulation, deterministic test data, sampling, fuzzing. When you need REPRODUCIBLE pseudorandom from a seed. Invariants: X1 64-bit output per step; full state advances. X2 Same seed -> same output sequence forever. X3 All-zeros state forbidden (would produce all zeros). seed_with implements the SplitMix64 trick to safely initialise from any 64-bit seed including 0. license_tier: INDEPENDENT_REDERIVE genealogy_id: international-research-sources/nist/sp_800_90a

dependencies 2 imports · 1 importers

nx_syscalls.nx nx_bits.nx nx_xoshiro.nx nx_proptest.nx

imports: nx_syscalls.nxnx_bits.nx

imported by: nx_proptest.nx

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main xoshiro_new sys_mmap xoshiro_seed sys_mmap ↻ xs_splitmix xoshiro_next xs_rotl nx_bits_rotl64 xoshiro_bounded xoshiro_next ↻

structs

35struct Xoshiro

consts

none

functions

43func xs_rotl(x: i64, k: i64) -> i64
called by 1: xoshiro_next calls 1: nx_bits_rotl64
50func xs_splitmix(state_p: *i64) -> i64
called by 1: xoshiro_seed
59func xoshiro_seed(rng: *Xoshiro, seed: i64) -> i64
called by 1: xoshiro_new calls 2: sys_mmapxs_splitmix
71func xoshiro_new(seed: i64) -> *Xoshiro
called by 2: mainmain calls 2: sys_mmapxoshiro_seed
80func xoshiro_next(rng: *Xoshiro) -> i64
called by 2: xoshiro_boundedmain calls 1: xs_rotl
94func xoshiro_bounded(rng: *Xoshiro, bound: i64) -> i64
105func main() -> i64