pub struct SystemRandom(/* private fields */);
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.
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