pub struct XorShift64Star(/* private fields */);Expand description
xorshift64*: a 64-bit xorshift state whose output is scrambled by one multiplication (Vigna, “An experimental exploration of Marsaglia’s xorshift generators, scrambled”, ACM TOMS 42(4), 2016). The seed is mixed with the golden-ratio constant and a zero seed is replaced by 1, since the all-zero state is a fixed point of xorshift.
use symplex::XorShift64Star;
assert_eq!(XorShift64Star::new(42).next_u64(), 0x1C28_3E14_F85F_D6CB);
// Seeds 0 and 1 coincide: 0 is not a usable xorshift state.
assert_eq!(XorShift64Star::new(0).next_u64(), XorShift64Star::new(1).next_u64());Implementations§
Source§impl XorShift64Star
impl XorShift64Star
Sourcepub fn next_big_below(&mut self, n: &BigInt) -> BigInt
pub fn next_big_below(&mut self, n: &BigInt) -> BigInt
A big integer uniform in 0..n up to the bias of reducing 64 more
random bits than n has (below 2⁻⁶⁴). n must be positive.
§Panics
If n is zero (reduction modulo zero).
Trait Implementations§
Source§impl Clone for XorShift64Star
impl Clone for XorShift64Star
Source§impl Debug for XorShift64Star
impl Debug for XorShift64Star
impl Eq for XorShift64Star
Source§impl Hash for XorShift64Star
impl Hash for XorShift64Star
Source§impl PartialEq for XorShift64Star
impl PartialEq for XorShift64Star
impl StructuralPartialEq for XorShift64Star
Auto Trait Implementations§
impl Freeze for XorShift64Star
impl RefUnwindSafe for XorShift64Star
impl Send for XorShift64Star
impl Sync for XorShift64Star
impl Unpin for XorShift64Star
impl UnsafeUnpin for XorShift64Star
impl UnwindSafe for XorShift64Star
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more