pub struct Rng { /* private fields */ }Expand description
xoshiro256++. A random generator with serializable state, used by random in scripts and by package commands
(Ctx::rng).
Implementations§
Source§impl Rng
impl Rng
Sourcepub fn unit_f64(&mut self) -> f64
pub fn unit_f64(&mut self) -> f64
A decimal in [0.0, 1.0) (uses the upper 53 bits; the same state gives the same value on every platform).
Sourcepub fn range_inclusive(&mut self, min: i64, max: i64) -> i64
pub fn range_inclusive(&mut self, min: i64, max: i64) -> i64
An integer in min..=max (both ends included). If min > max, returns min (the generator does not advance).
Maps into the range with Lemire’s method (multiplication with rejection) to avoid bias. On every platform, the same state gives the same value and consumes the same number of outputs.
Trait Implementations§
impl Eq for Rng
impl StructuralPartialEq for Rng
Auto Trait Implementations§
impl Forget for Rng
impl Freeze for Rng
impl Move 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