()
| 14 | |
| 15 | impl XorShift64Star { |
| 16 | pub fn new() -> Self { |
| 17 | // Any non-zero seed will do -- this uses the hash of a global counter. |
| 18 | let mut seed = 0; |
| 19 | while seed == 0 { |
| 20 | let mut hasher = DefaultHasher::new(); |
| 21 | static COUNTER: AtomicUsize = AtomicUsize::new(0); |
| 22 | hasher.write_usize(COUNTER.fetch_add(1, Ordering::Relaxed)); |
| 23 | seed = hasher.finish(); |
| 24 | } |
| 25 | |
| 26 | XorShift64Star { |
| 27 | state: Cell::new(seed), |
| 28 | } |
| 29 | } |
| 30 | |
| 31 | #[allow(dead_code)] |
| 32 | pub fn from_seed(seed: u64) -> Self { |
nothing calls this directly
no outgoing calls
no test coverage detected