pub trait Rng {
// Required methods
fn next_u32(&mut self) -> u32;
fn next_u64(&mut self) -> u64;
fn fill_bytes(&mut self, dest: &mut [u8]);
// Provided method
fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<()> { ... }
}Expand description
Core trait for random number generators
This trait provides the basic interface for generating random values.
It’s compatible with the rand crate’s RngCore trait for interoperability.
Required Methods§
Sourcefn fill_bytes(&mut self, dest: &mut [u8])
fn fill_bytes(&mut self, dest: &mut [u8])
Fill a byte buffer with random data
Provided Methods§
Sourcefn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<()>
fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<()>
Try to fill a byte buffer with random data (may fail)