pub struct Random<T> { /* private fields */ }Expand description
Random tensor generator for a specific element type.
Implementations§
Source§impl<T> Random<T>where
T: RandomValue,
impl<T> Random<T>where
T: RandomValue,
Sourcepub fn generate(range: (T, T), len: usize) -> Result<Tensor<T>>
pub fn generate(range: (T, T), len: usize) -> Result<Tensor<T>>
Generate a tensor with a default seed and options.
Sourcepub fn generate_with_opts(
range: (T, T),
len: usize,
opts: TensorOptions,
) -> Result<Tensor<T>>
pub fn generate_with_opts( range: (T, T), len: usize, opts: TensorOptions, ) -> Result<Tensor<T>>
Generate a tensor with custom options and default seed.
Sourcepub fn generate_with_seed(
seed: u64,
range: (T, T),
len: usize,
) -> Result<Tensor<T>>
pub fn generate_with_seed( seed: u64, range: (T, T), len: usize, ) -> Result<Tensor<T>>
Generate a tensor with an explicit seed.
Sourcepub fn generate_with_seed_opts(
seed: u64,
range: (T, T),
len: usize,
opts: TensorOptions,
) -> Result<Tensor<T>>
pub fn generate_with_seed_opts( seed: u64, range: (T, T), len: usize, opts: TensorOptions, ) -> Result<Tensor<T>>
Generate a tensor with an explicit seed and options.
Sourcepub fn next(&mut self, range: (T, T), len: usize) -> Result<Tensor<T>>
pub fn next(&mut self, range: (T, T), len: usize) -> Result<Tensor<T>>
Generate the next tensor using the internal RNG.
Sourcepub fn next_with_opts(
&mut self,
range: (T, T),
len: usize,
opts: TensorOptions,
) -> Result<Tensor<T>>
pub fn next_with_opts( &mut self, range: (T, T), len: usize, opts: TensorOptions, ) -> Result<Tensor<T>>
Generate the next tensor using the internal RNG and options.
Auto Trait Implementations§
impl<T> Freeze for Random<T>
impl<T> RefUnwindSafe for Random<T>where
T: RefUnwindSafe,
impl<T> Send for Random<T>where
T: Send,
impl<T> Sync for Random<T>where
T: Sync,
impl<T> Unpin for Random<T>where
T: Unpin,
impl<T> UnwindSafe for Random<T>where
T: UnwindSafe,
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