pub fn tls_rng() -> TlsWyRand
Expand description
Fetch a thread-local WyRand
use nanorand::Rng;
let mut rng = nanorand::tls_rng();
println!("Random number: {}", rng.generate::<u64>());
This cannot be passed to another thread, as something like this will fail to compile:
ⓘ
use nanorand::Rng;
let mut rng = nanorand::tls_rng();
std::thread::spawn(move || {
println!("Random number: {}", rng.generate::<u64>());
});