MCPcopy Create free account
hub / github.com/NthTensor/Forte / new

Method new

src/util.rs:16–29  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14
15impl 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 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected