DistributionExt

Trait DistributionExt 

Source
pub trait DistributionExt<T>: Distribution<T> + Sized {
    // Provided methods
    fn random_array<R: Rng, Dim: Dimension>(
        &self,
        rng: &mut Random<R>,
        shape: Dim,
    ) -> Array<T, Dim>
       where Self: Copy { ... }
    fn sample_vec<R: Rng>(&self, rng: &mut Random<R>, size: usize) -> Vec<T>
       where Self: Copy { ... }
}
Expand description

Extension trait for distributions to create arrays directly

This provides a consistent interface for generating random arrays across the SCIRS2 ecosystem.

Provided Methods§

Source

fn random_array<R: Rng, Dim: Dimension>( &self, rng: &mut Random<R>, shape: Dim, ) -> Array<T, Dim>
where Self: Copy,

Create a random array with values from this distribution

Source

fn sample_vec<R: Rng>(&self, rng: &mut Random<R>, size: usize) -> Vec<T>
where Self: Copy,

Create a random vector with values from this 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.

Implementors§

Source§

impl<D, T> DistributionExt<T> for D
where D: Distribution<T>,