1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use crate::{
bitops::rot_l,
rng_xoshiro256_core::xorshiro256_core,
};
pub struct Xoshiro256StarStar {
seeds: [u64; 4],
}
impl Xoshiro256StarStar {
pub fn new(seeds: [u64; 4]) -> Self {
Self { seeds }
}
pub fn next(&mut self) -> u64 {
let res = rot_l(self.seeds[1] * 5, 7) * 9;
self.seeds = xorshiro256_core(self.seeds);
res
}
}
impl Default for Xoshiro256StarStar {
fn default() -> Self {
Self::new([1; 4])
}
}
// TODO:
#[cfg(test)]
mod tests {
#[test]
fn test() {}
}