pub struct ThreadSafeRng { /* private fields */ }Expand description
Thread-safe random state management
Implementations§
Source§impl ThreadSafeRng
impl ThreadSafeRng
Sourcepub fn random_range(&self, n: usize) -> usize
pub fn random_range(&self, n: usize) -> usize
Generate a random integer in range [0, n)
Sourcepub fn sample_indices(
&self,
n_samples: usize,
size: usize,
replace: bool,
) -> UtilsResult<Vec<usize>>
pub fn sample_indices( &self, n_samples: usize, size: usize, replace: bool, ) -> UtilsResult<Vec<usize>>
Generate random indices for sampling
Auto Trait Implementations§
impl !Freeze for ThreadSafeRng
impl RefUnwindSafe for ThreadSafeRng
impl Send for ThreadSafeRng
impl Sync for ThreadSafeRng
impl Unpin for ThreadSafeRng
impl UnwindSafe for ThreadSafeRng
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