pub struct XorwowState {
pub s: [u32; 5],
pub d: u32,
}Expand description
Compact per-row XORWOW state. Layout matches curand_kernel.h’s
curandStateXORWOW_t for the five state lanes plus the addition
counter; we omit the boxmuller cache (PG sampler doesn’t use it).
Fields§
§s: [u32; 5]§d: u32Implementations§
Source§impl XorwowState
impl XorwowState
Sourcepub fn new(seed: u64, row: u64) -> Self
pub fn new(seed: u64, row: u64) -> Self
Stateless seeding from (seed, row). Each of the six state words
is the high or low half of a SplitMix64 hash of
splitmix64(seed ⊕ row·ROW_ZETA ⊕ word·WORD_GAMMA). The first
non-zero state word is enforced so we never enter the all-zero
XORWOW absorbing fixed point.
Sourcepub fn next_u32(&mut self) -> u32
pub fn next_u32(&mut self) -> u32
Single XORWOW advance. Returns the next 32-bit output and mutates
the state. Matches Marsaglia’s 2003 XORWOW formulation, which is
also what curand_kernel.h::xorwow computes.
Sourcepub fn next_unit(&mut self) -> f64
pub fn next_unit(&mut self) -> f64
Uniform double in (0, 1] — same (u32 + 1) / 2^32 convention the
kernel uses (matches curand_uniform_double upper-open interval
convention; we use the upper-closed variant so a zero u32 never
produces exactly zero, which would crash log(u) in the Exp draw).
Trait Implementations§
Source§impl Clone for XorwowState
impl Clone for XorwowState
Source§fn clone(&self) -> XorwowState
fn clone(&self) -> XorwowState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for XorwowState
Source§impl Debug for XorwowState
impl Debug for XorwowState
Source§impl PgRng for XorwowState
XorwowState is the randomness source for the bit-exact GPU oracle. Wiring
it through PgRng lets the shared Devroye core run against the same RNG
byte stream the device kernel consumes.
impl PgRng for XorwowState
XorwowState is the randomness source for the bit-exact GPU oracle. Wiring
it through PgRng lets the shared Devroye core run against the same RNG
byte stream the device kernel consumes.
Auto Trait Implementations§
impl Freeze for XorwowState
impl RefUnwindSafe for XorwowState
impl Send for XorwowState
impl Sync for XorwowState
impl Unpin for XorwowState
impl UnsafeUnpin for XorwowState
impl UnwindSafe for XorwowState
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
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>
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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.