RandomExt

Trait RandomExt 

Source
pub trait RandomExt<A, D: Dimension> {
    // Required methods
    fn random<Dist, R>(
        shape: D,
        distribution: Dist,
        rng: &mut Random<R>,
    ) -> Self
       where Dist: Distribution<A>,
             R: Rng;
    fn random_using<F, R>(shape: D, rng: &mut Random<R>, f: F) -> Self
       where F: FnMut() -> A,
             R: Rng;
    fn standard_normal<R>(shape: D, rng: &mut Random<R>) -> Self
       where A: From<f64>,
             R: Rng;
    fn standard_uniform<R>(shape: D, rng: &mut Random<R>) -> Self
       where A: From<f64>,
             R: Rng;
    fn normal<R>(shape: D, mean: f64, std: f64, rng: &mut Random<R>) -> Self
       where A: From<f64>,
             R: Rng;
    fn uniform<R>(shape: D, low: f64, high: f64, rng: &mut Random<R>) -> Self
       where A: From<f64>,
             R: Rng;
    fn beta<R>(shape: D, alpha: f64, beta: f64, rng: &mut Random<R>) -> Self
       where A: From<f64>,
             R: Rng;
    fn exponential<R>(shape: D, lambda: f64, rng: &mut Random<R>) -> Self
       where A: From<f64>,
             R: Rng;
    fn randint<R>(shape: D, low: i64, high: i64, rng: &mut Random<R>) -> Self
       where A: From<i64>,
             R: Rng;
}
Expand description

Extended random array generation trait for ndarray integration

This trait provides comprehensive random array generation functionality that integrates with the SCIRS2 Random struct and scientific distributions.

Required Methods§

Source

fn random<Dist, R>(shape: D, distribution: Dist, rng: &mut Random<R>) -> Self
where Dist: Distribution<A>, R: Rng,

Generate a random array using any distribution

Source

fn random_using<F, R>(shape: D, rng: &mut Random<R>, f: F) -> Self
where F: FnMut() -> A, R: Rng,

Generate a random array using a closure

Source

fn standard_normal<R>(shape: D, rng: &mut Random<R>) -> Self
where A: From<f64>, R: Rng,

Generate a standard normal random array (mean=0, std=1)

Source

fn standard_uniform<R>(shape: D, rng: &mut Random<R>) -> Self
where A: From<f64>, R: Rng,

Generate a standard uniform random array [0, 1)

Source

fn normal<R>(shape: D, mean: f64, std: f64, rng: &mut Random<R>) -> Self
where A: From<f64>, R: Rng,

Generate a normal random array with specified mean and standard deviation

Source

fn uniform<R>(shape: D, low: f64, high: f64, rng: &mut Random<R>) -> Self
where A: From<f64>, R: Rng,

Generate a uniform random array in [low, high)

Source

fn beta<R>(shape: D, alpha: f64, beta: f64, rng: &mut Random<R>) -> Self
where A: From<f64>, R: Rng,

Generate random array from Beta distribution

Source

fn exponential<R>(shape: D, lambda: f64, rng: &mut Random<R>) -> Self
where A: From<f64>, R: Rng,

Generate random array from exponential distribution

Source

fn randint<R>(shape: D, low: i64, high: i64, rng: &mut Random<R>) -> Self
where A: From<i64>, R: Rng,

Generate random integers in range [low, high)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<A, S, D> RandomExt<A, D> for ArrayBase<S, D>
where S: DataOwned<Elem = A>, D: Dimension, A: Clone,