pub struct SimRng { /* private fields */ }Expand description
Simulation seed for deterministic randomness.
Implementations§
Source§impl SimRng
impl SimRng
pub fn new(seed: u64) -> Self
Sourcepub fn next_u64(&mut self) -> u64
pub fn next_u64(&mut self) -> u64
xorshift64 — fast, deterministic, good enough for simulation.
Sourcepub fn should_drop(&mut self, loss_rate: f64) -> bool
pub fn should_drop(&mut self, loss_rate: f64) -> bool
Should we drop this message? (based on loss rate 0.0-1.0)
Sourcepub fn random_peer(&mut self, self_idx: usize, total: usize) -> usize
pub fn random_peer(&mut self, self_idx: usize, total: usize) -> usize
Pick a random peer index (not self).
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