Struct Mcg128Xsl64
struct Mcg128Xsl64 { ... }
A PCG random number generator (XSL 128/64 (MCG) variant).
Permuted Congruential Generator with 128-bit state, internal Multiplicative Congruential Generator, and 64-bit output via "xorshift low (bits), random rotation" output function.
This is a 128-bit MCG with the PCG-XSL-RR output function, also known as
pcg64_fast.
Note that compared to the standard pcg64 (128-bit LCG with PCG-XSL-RR
output function), this RNG is faster, also has a long cycle, and still has
good performance on statistical tests.
Implementations
impl Mcg128Xsl64
fn advance(self: &mut Self, delta: u128)Multi-step advance functions (jump-ahead, jump-back)
The method used here is based on Brown, "Random Number Generation with Arbitrary Stride,", Transactions of the American Nuclear Society (Nov. 1994). The algorithm is very similar to fast exponentiation.
Even though delta is an unsigned integer, we can pass a signed integer to go backwards, it just goes "the long way round".
Using this function is equivalent to calling
next_64()deltanumber of times.fn new(state: u128) -> SelfConstruct an instance compatible with PCG seed.
Note that PCG specifies a default value for the parameter:
state = 0xcafef00dd15ea5e5
impl Clone for Mcg128Xsl64
fn clone(self: &Self) -> Mcg128Xsl64
impl Debug for Mcg128Xsl64
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl Eq for Mcg128Xsl64
impl Freeze for Mcg128Xsl64
impl PartialEq for Mcg128Xsl64
fn eq(self: &Self, other: &Mcg128Xsl64) -> bool
impl RefUnwindSafe for Mcg128Xsl64
impl RngCore for Mcg128Xsl64
fn next_u32(self: &mut Self) -> u32fn next_u64(self: &mut Self) -> u64fn fill_bytes(self: &mut Self, dest: &mut [u8])
impl SeedableRng for Mcg128Xsl64
fn from_seed(seed: <Self as >::Seed) -> Self
impl Send for Mcg128Xsl64
impl Serialize for Mcg128Xsl64
fn serialize<__S>(self: &Self, __serializer: __S) -> Result<<__S as >::Ok, <__S as >::Error> where __S: Serializer
impl StructuralPartialEq for Mcg128Xsl64
impl Sync for Mcg128Xsl64
impl Unpin for Mcg128Xsl64
impl UnsafeUnpin for Mcg128Xsl64
impl UnwindSafe for Mcg128Xsl64
impl<'de> Deserialize for Mcg128Xsl64
fn deserialize<__D>(__deserializer: __D) -> Result<Self, <__D as >::Error> where __D: Deserializer<'de>
impl<R> TryRngCore for Mcg128Xsl64
fn try_next_u32(self: &mut Self) -> Result<u32, <R as TryRngCore>::Error>fn try_next_u64(self: &mut Self) -> Result<u64, <R as TryRngCore>::Error>fn try_fill_bytes(self: &mut Self, dst: &mut [u8]) -> Result<(), <R as TryRngCore>::Error>
impl<T> Any for Mcg128Xsl64
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Mcg128Xsl64
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Mcg128Xsl64
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for Mcg128Xsl64
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> DeserializeOwned for Mcg128Xsl64
impl<T> From for Mcg128Xsl64
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for Mcg128Xsl64
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T, U> Into for Mcg128Xsl64
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for Mcg128Xsl64
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Mcg128Xsl64
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>