pub struct SplitMix64 { /* private fields */ }Expand description
A splitmix64 generator (Steele, Lea & Flood 2014).
Carries its 64-bit state, advances by the golden gamma and runs the xorshift-multiply output function. Two bytes of state for a passing statistical battery is the reason this and not an LCG is the shared PRNG: tests that need deterministic “random” data seed it with a constant, never with the clock.
let mut rng = pith_digest::SplitMix64::new(0);
assert_eq!(rng.next_u64(), 0xe220_a839_7b1d_cdaf);
assert_eq!(rng.next_u64(), 0x6e78_9e6a_a1b9_65f4);Implementations§
Source§impl SplitMix64
impl SplitMix64
Sourcepub fn fill_bytes(&mut self, out: &mut [u8])
pub fn fill_bytes(&mut self, out: &mut [u8])
Produces n pseudo-random bytes, filling out exactly.
Deterministic in out.len() and the seed alone, so a test can
regenerate the same corpus on any machine.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SplitMix64
impl RefUnwindSafe for SplitMix64
impl Send for SplitMix64
impl Sync for SplitMix64
impl Unpin for SplitMix64
impl UnsafeUnpin for SplitMix64
impl UnwindSafe for SplitMix64
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more