Struct ring::rand::SystemRandom
source · 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 moreAuto Trait Implementations§
impl Freeze for SystemRandom
impl RefUnwindSafe for SystemRandom
impl Send for SystemRandom
impl Sync for SystemRandom
impl Unpin for SystemRandom
impl UnwindSafe for SystemRandom
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)