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§
Sourcefn random<Dist, R>(shape: D, distribution: Dist, rng: &mut Random<R>) -> Selfwhere
Dist: Distribution<A>,
R: Rng,
fn random<Dist, R>(shape: D, distribution: Dist, rng: &mut Random<R>) -> Selfwhere
Dist: Distribution<A>,
R: Rng,
Generate a random array using any distribution
Sourcefn random_using<F, R>(shape: D, rng: &mut Random<R>, f: F) -> Self
fn random_using<F, R>(shape: D, rng: &mut Random<R>, f: F) -> Self
Generate a random array using a closure
Sourcefn standard_normal<R>(shape: D, rng: &mut Random<R>) -> Self
fn standard_normal<R>(shape: D, rng: &mut Random<R>) -> Self
Generate a standard normal random array (mean=0, std=1)
Sourcefn standard_uniform<R>(shape: D, rng: &mut Random<R>) -> Self
fn standard_uniform<R>(shape: D, rng: &mut Random<R>) -> Self
Generate a standard uniform random array [0, 1)
Sourcefn normal<R>(shape: D, mean: f64, std: f64, rng: &mut Random<R>) -> Self
fn normal<R>(shape: D, mean: f64, std: f64, rng: &mut Random<R>) -> Self
Generate a normal random array with specified mean and standard deviation
Sourcefn uniform<R>(shape: D, low: f64, high: f64, rng: &mut Random<R>) -> Self
fn uniform<R>(shape: D, low: f64, high: f64, rng: &mut Random<R>) -> Self
Generate a uniform random array in [low, high)
Sourcefn beta<R>(shape: D, alpha: f64, beta: f64, rng: &mut Random<R>) -> Self
fn beta<R>(shape: D, alpha: f64, beta: f64, rng: &mut Random<R>) -> Self
Generate random array from Beta distribution
Sourcefn exponential<R>(shape: D, lambda: f64, rng: &mut Random<R>) -> Self
fn exponential<R>(shape: D, lambda: f64, rng: &mut Random<R>) -> Self
Generate random array from exponential distribution
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.