xoshiro.nx
buildroot/runtime/xoshiro.nx
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.
dependencies 2 imports · 1 importers
imports: syscalls.nxnx_bits.nx
imported by: proptest.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| 25 | struct Xoshiro { |
consts
| none |
functions
| 35 | func xs_rotl(x: i64, k: i64) -> i64 { |
| 42 | func xs_splitmix(state_p: *i64) -> i64 {
called by 1: xoshiro_seed |
| 51 | func xoshiro_seed(rng: *Xoshiro, seed: i64) -> i64 { |
| 63 | func xoshiro_new(seed: i64) -> *Xoshiro { |
| 72 | func xoshiro_next(rng: *Xoshiro) -> i64 { |
| 86 | func xoshiro_bounded(rng: *Xoshiro, bound: i64) -> i64 { |
| 97 | func main() -> i64 { |