pub struct RandomSampler { /* private fields */ }Expand description
Yields a uniformly shuffled permutation of indices every epoch.
Uses the inside-out Fisher-Yates algorithm with fastrand (wyrand):
a single-multiply PRNG that is ~30% faster than Xoshiro256++ for this
workload. The inside-out variant builds and shuffles in a single forward
pass — no pre-fill, and random accesses stay within the already-written
prefix [0..i] for better cache behaviour.
Implementations§
Source§impl RandomSampler
impl RandomSampler
Sourcepub fn from_entropy() -> Self
pub fn from_entropy() -> Self
Seed from OS entropy. Use this when reproducibility is not required.
Trait Implementations§
Source§impl Debug for RandomSampler
impl Debug for RandomSampler
Source§impl Sampler for RandomSampler
impl Sampler for RandomSampler
Auto Trait Implementations§
impl Forget for RandomSampler
impl Freeze for RandomSampler
impl RefUnwindSafe for RandomSampler
impl Send for RandomSampler
impl Sync for RandomSampler
impl Unpin for RandomSampler
impl UnsafeUnpin for RandomSampler
impl UnwindSafe for RandomSampler
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> 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