pub fn rapidrng_time(seed: &mut u64) -> u64
Expand description
Generate a random number non-deterministically by re-seeding with the current time.
This is not a cryptographic random number generator.
Note fetching system time requires a syscall and is therefore much slower than rapidrng_fast. It can also be used to seed rapidrng_fast.
Requires the std
feature and a platform that supports std::time::SystemTime.
ยงExample
use rapidhash::{rapidrng_fast, rapidrng_time};
// choose a non-deterministic random seed (50-100ns)
let mut seed = rapidrng_time(&mut 0);
// rapid fast deterministic random numbers (~1ns/iter)
for _ in 0..10 {
println!("{}", rapidrng_fast(&mut seed));
}