Minimal, dependency-free implementations of SplitMix32 and SplitMix64 in Rust.
no_std compatible, with no allocation or external dependencies.
- SplitMix32 (
u32) and SplitMix64 (u64) - Simple
new()andnext()API - No external dependencies
no_stdcompatible- No allocation
use splitmix::{SplitMix32, SplitMix64};
let mut sm32 = SplitMix32::new(42);
let mut sm64 = SplitMix64::new(42);
let a: u32 = sm32.next();
let b: u64 = sm64.next();SplitMix is particularly useful for expanding a single seed into multiple values for initializing other pseudorandom number generators.
use splitmix::SplitMix64;
let mut sm = SplitMix64::new(42);
let state = [
sm.next(),
sm.next(),
sm.next(),
sm.next(),
];- All seeds are valid, including zero.
- The same seed produces the same sequence.
- SplitMix is not cryptographically secure.
- SplitMix32 and SplitMix64 have only 32-bit and 64-bit internal states, respectively. They are primarily intended for seed initialization rather than applications requiring large state spaces or cryptographic security.