pub struct Rng { /* private fields */ }Expand description
A deterministic, seedable random number generator.
Implementations§
Source§impl Rng
impl Rng
Sourcepub fn from_seed(seed: u64) -> Self
pub fn from_seed(seed: u64) -> Self
A generator with an explicit seed: the same seed always yields the same sequence.
Sourcepub fn u32(&mut self, range: Range<u32>) -> u32
pub fn u32(&mut self, range: Range<u32>) -> u32
A u32 uniformly distributed in range.
§Panics
If range is empty (range.start >= range.end), an authoring error.
Sourcepub fn i32(&mut self, range: Range<i32>) -> i32
pub fn i32(&mut self, range: Range<i32>) -> i32
An i32 uniformly distributed in range.
§Panics
If range is empty (range.start >= range.end), an authoring error.
Trait Implementations§
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