Trait MultiDistribution

Source
pub trait MultiDistribution<T> {
    // Required methods
    fn sample_len(&self) -> usize;
    fn sample_to_slice<R: Rng + ?Sized>(&self, rng: &mut R, output: &mut [T]);
}
Expand description

A standard abstraction for distributions with multi-dimensional results

Implementations may also implement Distribution<Vec<T>>.

Required Methods§

Source

fn sample_len(&self) -> usize

The length of a sample (dimension of the distribution)

Source

fn sample_to_slice<R: Rng + ?Sized>(&self, rng: &mut R, output: &mut [T])

Sample a multi-dimensional result from the distribution

The result is written to output. Implementations should assert that output.len() equals the result of Self::sample_len.

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§