pub struct FastRng { /* private fields */ }Expand description
A small, fast, non-cryptographic rng with decent statistical properties.
Useful for sampling non-security sensitive data or as a deterministic RNG
for tests (instead of the SysRng above, which uses the global OS RNG).
The implementation is the same as Xoroshiro64Star.
Implementations§
Trait Implementations§
Source§impl RngCore for FastRng
impl RngCore for FastRng
Source§fn fill_bytes(&mut self, dest: &mut [u8])
fn fill_bytes(&mut self, dest: &mut [u8])
Fill
dest with random data. Read moreAuto Trait Implementations§
impl Freeze for FastRng
impl RefUnwindSafe for FastRng
impl Send for FastRng
impl Sync for FastRng
impl Unpin for FastRng
impl UnsafeUnpin for FastRng
impl UnwindSafe for FastRng
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
Source§impl<R> RngExt for Rwhere
R: RngCore,
impl<R> RngExt for Rwhere
R: RngCore,
fn gen_bytes<const N: usize>(&mut self) -> [u8; N]
fn gen_u32(&mut self) -> u32
fn gen_u64(&mut self) -> u64
fn gen_u8(&mut self) -> u8
fn gen_u16(&mut self) -> u16
fn gen_u128(&mut self) -> u128
Source§fn gen_boolean(&mut self) -> bool
fn gen_boolean(&mut self) -> bool
Flip a coin. Generate
true with probability 0.5Source§fn gen_range_i32(&mut self, range: Range<i32>) -> i32
fn gen_range_i32(&mut self, range: Range<i32>) -> i32
Generates an
i32 in [range.start, range.end). Has slight modulo
bias for large ranges. See fastmap32.Source§fn gen_range_u32(&mut self, range: Range<u32>) -> u32
fn gen_range_u32(&mut self, range: Range<u32>) -> u32
Generates a
u32 in [range.start, range.end). Has slight modulo
bias for large ranges. See fastmap32.Source§fn gen_range_u64(&mut self, range: Range<u64>) -> u64
fn gen_range_u64(&mut self, range: Range<u64>) -> u64
Generates a
u32 in [range.start, range.end). Has slight modulo
bias for large ranges. See fastmap64.