pub trait Rng {
// Required method
fn next_u64(&mut self) -> u64;
// Provided methods
fn next_u32(&mut self) -> u32 { ... }
fn next_u8(&mut self) -> u8 { ... }
fn chance(&mut self, numerator: u32, denominator: u32) -> bool { ... }
fn index(&mut self, len: usize) -> usize { ... }
}Expand description
A seeded random number generator for deterministic simulation.
All randomness in the simulation must flow through this trait. The same seed must produce the same sequence of values - this is what makes simulation runs reproducible and replayable.
Required Methods§
Provided Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".