pub struct SimRng { /* private fields */ }Expand description
A splitmix64 pseudo-random stream.
Implementations§
Source§impl SimRng
impl SimRng
Sourcepub fn from_seed(seed: Seed) -> Self
pub fn from_seed(seed: Seed) -> Self
Creates a stream from a seed. A zero state is fine for splitmix64.
Sourcepub fn below(&mut self, n: u64) -> u64
pub fn below(&mut self, n: u64) -> u64
Uniform value in 0..n, using the multiply-high trick to avoid
modulo bias. Panics if n is zero.
Sourcepub fn range(&mut self, min: u64, max: u64) -> u64
pub fn range(&mut self, min: u64, max: u64) -> u64
Uniform value in min..max (half-open). Panics on an empty range.
Sourcepub fn fork_label(&self, label: &str) -> SimRng
pub fn fork_label(&self, label: &str) -> SimRng
Derives a named independent stream without advancing this one. The label is mixed into the current state with FNV-1a.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SimRng
impl RefUnwindSafe for SimRng
impl Send for SimRng
impl Sync for SimRng
impl Unpin for SimRng
impl UnsafeUnpin for SimRng
impl UnwindSafe for SimRng
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
Mutably borrows from an owned value. Read more