pub struct RANDU(/* private fields */);Expand description
Structure holding current state of RANDU generator.
Generator uses last generated number as its internal state.
Implementations§
source§impl RANDU
impl RANDU
sourcepub fn seed(seed: i32) -> Self
pub fn seed(seed: i32) -> Self
Creates new RANDU generator with provided seed.
MCG generators seed can’t be zero or multiple of M.
Function will panic if called with zero or M seed. You can seed with negative number as long it is not -1 which is wrapped M.
sourcepub fn next(&mut self) -> i32
pub fn next(&mut self) -> i32
Get next non negative 31-bit integer from generator.
Returned value is in inclusive range from zero to M-1.
sourcepub fn nextDouble(&mut self) -> f64
pub fn nextDouble(&mut self) -> f64
Get next double value from generator.
Returned value is in range zero inclusive to 1.0 exclusive.
Auto Trait Implementations§
impl Freeze for RANDU
impl RefUnwindSafe for RANDU
impl Send for RANDU
impl Sync for RANDU
impl Unpin for RANDU
impl UnwindSafe for RANDU
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