pub struct Rng { /* private fields */ }Implementations§
Source§impl Rng
impl Rng
pub fn new(seed: u64) -> Self
pub fn fork(&self, label: u64) -> Self
pub fn state(&self) -> RngState
pub fn from_state(state: RngState) -> Self
pub fn save(&self) -> [u8; 44]
pub fn restore(bytes: &[u8]) -> Result<Self, SimError>
pub fn next_u64(&mut self) -> u64
pub fn next_u32(&mut self) -> u32
pub fn next_bool(&mut self) -> bool
pub fn next_f64(&mut self) -> f64
pub fn next_f32(&mut self) -> f32
pub fn chance(&mut self, probability: f64) -> bool
pub fn below(&mut self, n: u64) -> u64
pub fn below_u32(&mut self, n: u32) -> u32
pub fn index(&mut self, len: usize) -> usize
pub fn range_u64(&mut self, lo: u64, hi: u64) -> u64
pub fn range_i64(&mut self, lo: i64, hi: i64) -> i64
pub fn range_i32(&mut self, lo: i32, hi: i32) -> i32
pub fn range_f64(&mut self, lo: f64, hi: f64) -> f64
pub fn range_f32(&mut self, lo: f32, hi: f32) -> f32
pub fn shuffle<T>(&mut self, items: &mut [T])
pub fn choose<'a, T>(&mut self, items: &'a [T]) -> Option<&'a T>
pub fn weighted_index(&mut self, weights: &[f64]) -> Option<usize>
pub fn weighted_index_u32(&mut self, weights: &[u32]) -> Option<usize>
Trait Implementations§
impl Eq for Rng
impl StructuralPartialEq for Rng
Auto Trait Implementations§
impl Freeze for Rng
impl RefUnwindSafe for Rng
impl Send for Rng
impl Sync for Rng
impl Unpin for Rng
impl UnsafeUnpin for Rng
impl UnwindSafe for Rng
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