pub trait Rng {
// Required method
fn fill<A>(&self, arr: A) -> Option<A>
where A: AsMut<[u8]>;
// Provided methods
fn gen_u64(&self) -> Option<u64> { ... }
fn gen_u128(&self) -> Option<u128> { ... }
}Expand description
A non-cryptographic source of randomness.
Required Methods§
Sourcefn fill<A>(&self, arr: A) -> Option<A>
fn fill<A>(&self, arr: A) -> Option<A>
Fill a buffer with random data.
This method may return None if the buffer couldn’t be filled with random data for any reason.
The buffer is expected to have a consistent implementation of AsMut that always returns a reference to the same underlying bytes. This isn’t required for safety, but can lead to unexpected results.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".