pub struct SplitMix64 { /* private fields */ }Expand description
๐ฒ SplitMix64 pseudo-random number generator.
๐ num/prob/rand
A small 64-bit-state generator useful for seed expansion, simple streams, and diffusing weak seed material.
This is not a cryptographic generator.
Implementationsยง
Sourceยงimpl SplitMix64
impl SplitMix64
Sourcepub const GOLDEN_GAMMA: u64 = 0x9E37_79B9_7F4A_7C15
pub const GOLDEN_GAMMA: u64 = 0x9E37_79B9_7F4A_7C15
Weyl increment derived from the 64-bit fractional golden ratio.
Sourcepub const fn fill_bytes(&mut self, buffer: &mut [u8])
pub const fn fill_bytes(&mut self, buffer: &mut [u8])
Fills the buffer with generated bytes.
Trait Implementationsยง
Sourceยงimpl Clone for SplitMix64
impl Clone for SplitMix64
Sourceยงfn clone(&self) -> SplitMix64
fn clone(&self) -> SplitMix64
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) ยท Sourceยงfn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSourceยงimpl ConstInit for SplitMix64
Provides a fixed default initialized value.
impl ConstInit for SplitMix64
Provides a fixed default initialized value.
impl Copy for SplitMix64
Sourceยงimpl Debug for SplitMix64
impl Debug for SplitMix64
Sourceยงimpl Default for SplitMix64
Creates SplitMix64::INIT as the default value.
impl Default for SplitMix64
Creates SplitMix64::INIT as the default value.
impl Eq for SplitMix64
Sourceยงimpl PartialEq for SplitMix64
impl PartialEq for SplitMix64
Sourceยงfn eq(&self, other: &SplitMix64) -> bool
fn eq(&self, other: &SplitMix64) -> bool
Tests for
self and other values to be equal, and is used by ==.Sourceยงimpl RandSeedable for SplitMix64
impl RandSeedable for SplitMix64
Sourceยงimpl RandTry for SplitMix64
impl RandTry for SplitMix64
Sourceยงconst RAND_OUTPUT_BITS: u32 = 64
const RAND_OUTPUT_BITS: u32 = 64
Number of bits produced per output step. Read more
Sourceยงconst RAND_STATE_BITS: u32 = 64
const RAND_STATE_BITS: u32 = 64
Size of the source state owned by this value, in bits. Read more
Sourceยงconst RAND_QUALITIES: RandQualities = RandQualities::PRNG
const RAND_QUALITIES: RandQualities = RandQualities::PRNG
Semantic qualities of this random source.
Sourceยงtype Error = Infallible
type Error = Infallible
Error returned when complete random data could not be produced.
Sourceยงfn rand_try_next_u64(&mut self) -> InfallibleResult<u64>
fn rand_try_next_u64(&mut self) -> InfallibleResult<u64>
Attempts to produce the next 64 bits of randomness.
Sourceยงfn rand_try_fill_bytes(&mut self, buffer: &mut [u8]) -> InfallibleResult<()>
fn rand_try_fill_bytes(&mut self, buffer: &mut [u8]) -> InfallibleResult<()>
Attempts to fill the buffer with generated bytes. Read more
Sourceยงfn rand_qualities(&self) -> RandQualities
fn rand_qualities(&self) -> RandQualities
Returns the semantic qualities of this random source.
Sourceยงfn rand_try_next_u128(&mut self) -> Result<u128, Self::Error> โ
fn rand_try_next_u128(&mut self) -> Result<u128, Self::Error> โ
Attempts to produce the next random
u128.Sourceยงfn rand_try_next_u32(&mut self) -> Result<u32, Self::Error> โ
fn rand_try_next_u32(&mut self) -> Result<u32, Self::Error> โ
Attempts to produce the next random
u32.Sourceยงfn rand_try_next_u16(&mut self) -> Result<u16, Self::Error> โ
fn rand_try_next_u16(&mut self) -> Result<u16, Self::Error> โ
Attempts to produce the next random
u16.Sourceยงfn rand_try_next_u8(&mut self) -> Result<u8, Self::Error> โ
fn rand_try_next_u8(&mut self) -> Result<u8, Self::Error> โ
Attempts to produce the next random
u8.Sourceยงfn rand_try_next_bool(&mut self) -> Result<bool, Self::Error> โ
fn rand_try_next_bool(&mut self) -> Result<bool, Self::Error> โ
Attempts to produce a random boolean.
Sourceยงfn rand_try_below(&mut self, upper: u64) -> Result<u64, Self::Error> โ
fn rand_try_below(&mut self, upper: u64) -> Result<u64, Self::Error> โ
Attempts to return a uniformly random integer in
0..upper. Read moreSourceยงfn rand_try_range(&mut self, low: u64, high: u64) -> Result<u64, Self::Error> โ
fn rand_try_range(&mut self, low: u64, high: u64) -> Result<u64, Self::Error> โ
Attempts to return a uniformly random integer in
low..high. Read moreSourceยงfn rand_try_roll(&mut self, sides: u64) -> Result<u64, Self::Error> โ
fn rand_try_roll(&mut self, sides: u64) -> Result<u64, Self::Error> โ
Attempts to roll a fair die with a number of
sides. Read moreSourceยงfn rand_try_shuffle<T>(&mut self, slice: &mut [T]) -> Result<(), Self::Error> โ
fn rand_try_shuffle<T>(&mut self, slice: &mut [T]) -> Result<(), Self::Error> โ
Attempts to shuffle the elements of the slice in place. Read more
Sourceยงimpl SeedableRng for SplitMix64
Available on crate feature dep_rand_core only.
impl SeedableRng for SplitMix64
Available on crate feature
dep_rand_core only.Sourceยงtype Seed = <SplitMix64 as RandSeedable>::RandSeed
type Seed = <SplitMix64 as RandSeedable>::RandSeed
Seed type, which is restricted to types mutably-dereferenceable as
u8
arrays (we recommend [u8; N] for some N). Read moreยงfn seed_from_u64(state: u64) -> Self
fn seed_from_u64(state: u64) -> Self
Create a new PRNG using a
u64 seed. Read moreยงfn from_rng<R>(rng: &mut R) -> Selfwhere
R: Rng + ?Sized,
fn from_rng<R>(rng: &mut R) -> Selfwhere
R: Rng + ?Sized,
Create a new PRNG seeded from an infallible
Rng. Read moreimpl StructuralPartialEq for SplitMix64
Sourceยงimpl TryRng for SplitMix64
Available on crate feature dep_rand_core only.
impl TryRng for SplitMix64
Available on crate feature
dep_rand_core only.Auto Trait Implementationsยง
impl Freeze for SplitMix64
impl RefUnwindSafe for SplitMix64
impl Send for SplitMix64
impl Sync for SplitMix64
impl Unpin for SplitMix64
impl UnsafeUnpin for SplitMix64
impl UnwindSafe for SplitMix64
Blanket Implementationsยง
Sourceยงimpl<T> AnyExt for T
impl<T> AnyExt for T
Sourceยงfn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
Returns a deterministic hash of the
TypeId of Self using a custom hasher.Sourceยงfn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
Sourceยงfn as_any_box(self: Box<Self>) -> Box<dyn Any>where
Self: Sized,
fn as_any_box(self: Box<Self>) -> Box<dyn Any>where
Self: Sized,
Available on crate feature
alloc only.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<T> ByteSized for T
impl<T> ByteSized for T
Sourceยงconst BYTE_ALIGN: usize = _
const BYTE_ALIGN: usize = _
The alignment of this type in bytes.
Sourceยงfn byte_align(&self) -> usize
fn byte_align(&self) -> usize
Returns the alignment of this type in bytes.
Sourceยงfn ptr_size_ratio(&self) -> [usize; 2]
fn ptr_size_ratio(&self) -> [usize; 2]
Sourceยงimpl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
ยงimpl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
ยงfn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
Sourceยงimpl<T> MemExt for Twhere
T: ?Sized,
impl<T> MemExt for Twhere
T: ?Sized,
Sourceยงconst NEEDS_DROP: bool = _
const NEEDS_DROP: bool = _
Know whether dropping values of this type matters, in compile-time.
Sourceยงfn mem_align_of<T>() -> usize
fn mem_align_of<T>() -> usize
Returns the minimum alignment of the type in bytes. Read more
Sourceยงfn mem_align_of_val(&self) -> usize
fn mem_align_of_val(&self) -> usize
Returns the alignment of the pointed-to value in bytes. Read more
Sourceยงfn mem_size_of<T>() -> usize
fn mem_size_of<T>() -> usize
Returns the size of a type in bytes. Read more
Sourceยงfn mem_size_of_val(&self) -> usize
fn mem_size_of_val(&self) -> usize
Returns the size of the pointed-to value in bytes. Read more
Sourceยงfn mem_needs_drop(&self) -> bool
fn mem_needs_drop(&self) -> bool
Returns
true if dropping values of this type matters. Read moreSourceยงfn mem_forget(self)where
Self: Sized,
fn mem_forget(self)where
Self: Sized,
Forgets about
self without running its destructor. Read moreSourceยงfn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
Sourceยงunsafe fn mem_zeroed<T>() -> T
unsafe fn mem_zeroed<T>() -> T
Available on crate feature
unsafe_layout only.Returns the value of type
T represented by the all-zero byte-pattern. Read moreSourceยงunsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
Available on crate feature
unsafe_layout only.Returns the value of type
T represented by the all-zero byte-pattern. Read moreSourceยงfn mem_as_bytes(&self) -> &[u8] โ
fn mem_as_bytes(&self) -> &[u8] โ
Available on crate feature
unsafe_slice only.Sourceยงimpl<T, R> Morph<R> for Twhere
T: ?Sized,
impl<T, R> Morph<R> for Twhere
T: ?Sized,
Sourceยงimpl<R> Rand for R
impl<R> Rand for R
Sourceยงfn rand_next_u128(&mut self) -> u128
fn rand_next_u128(&mut self) -> u128
Returns the next random
u128.Sourceยงfn rand_next_u64(&mut self) -> u64
fn rand_next_u64(&mut self) -> u64
Returns the next random
u64.Sourceยงfn rand_next_u32(&mut self) -> u32
fn rand_next_u32(&mut self) -> u32
Returns the next random
u32.Sourceยงfn rand_next_u16(&mut self) -> u16
fn rand_next_u16(&mut self) -> u16
Returns the next random
u16.Sourceยงfn rand_next_u8(&mut self) -> u8
fn rand_next_u8(&mut self) -> u8
Returns the next random
u8.Sourceยงfn rand_next_bool(&mut self) -> bool
fn rand_next_bool(&mut self) -> bool
Produces a random boolean.
Sourceยงfn rand_fill_bytes(&mut self, buf: &mut [u8])
fn rand_fill_bytes(&mut self, buf: &mut [u8])
Fills the buffer with generated bytes.
Sourceยงfn rand_below(&mut self, upper: u64) -> u64
fn rand_below(&mut self, upper: u64) -> u64
Returns a uniformly random integer in
0..upper. Read moreSourceยงfn rand_range(&mut self, low: u64, high: u64) -> u64
fn rand_range(&mut self, low: u64, high: u64) -> u64
Returns a uniformly random integer in
low..high. Read moreSourceยงfn rand_roll(&mut self, sides: u64) -> u64
fn rand_roll(&mut self, sides: u64) -> u64
Rolls a fair die with a number of
sides. Read moreSourceยงfn rand_shuffle<T>(&mut self, slice: &mut [T])
fn rand_shuffle<T>(&mut self, slice: &mut [T])
Shuffles the elements of the slice in place. Read more