Struct ring::rand::SystemRandom
source · pub struct SystemRandom(());
Expand description
A secure random number generator where the random values come directly from the operating system.
“Directly from the operating system” here presently means “whatever the
getrandom
crate does” but that may change in the future. That roughly
means calling libc’s getrandom
function or whatever is analogous to that;
see the getrandom
crate’s documentation for more info.
A single SystemRandom
may be shared across multiple threads safely.
new()
is guaranteed to always succeed and to have low latency; it won’t
try to open or read from a file or do similar things. The first call to
fill()
may block a substantial amount of time since any and all
initialization is deferred to it. Therefore, it may be a good idea to call
fill()
once at a non-latency-sensitive time to minimize latency for
future calls.
Tuple Fields§
§0: ()
Implementations§
source§impl SystemRandom
impl SystemRandom
Trait Implementations§
source§impl Clone for SystemRandom
impl Clone for SystemRandom
source§fn clone(&self) -> SystemRandom
fn clone(&self) -> SystemRandom
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more