added set seed function

This commit is contained in:
Monica Moniot
2023-12-13 11:01:34 -05:00
parent 7f55b0a662
commit 3da21fb367
+8
View File
@@ -94,6 +94,14 @@ impl XorshiftRandom {
state.jump();
ret
}
#[cfg(test)]
pub fn set_test_seed(&self, seed: u64) {
use std::ops::DerefMut;
let mut state = GLOBAL_XORSHIFT.lock().unwrap();
*Lazy::force_mut(state.deref_mut()) = Xoshiro256StarStar::seed_from_u64(seed);
}
}
impl RngCore for XorshiftRandom {
fn next_u32(&mut self) -> u32 {