Struct IIDDistr

Source
pub struct IIDDistr<D> { /* private fields */ }
Expand description

A distribution on arrays whose elements are i.i.d. with distribution D.

See crate-level documentation for more information.

Implementations§

Source§

impl<D> IIDDistr<D>

Source

pub const fn new(d: D) -> Self

Create an i.i.d. distribution, where each array element is distributed according to D.

§Examples
let distr = IIDDistr::new(StandardNormal);
let mut rng = rand::thread_rng();
// Each of x element is distributed according to StandardNormal
let x : [f64; 10] = distr.sample(&mut rng);

Trait Implementations§

Source§

impl<D: Clone> Clone for IIDDistr<D>

Source§

fn clone(&self) -> IIDDistr<D>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<D: Debug> Debug for IIDDistr<D>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<D: Default> Default for IIDDistr<D>

Source§

fn default() -> IIDDistr<D>

Returns the “default value” for a type. Read more
Source§

impl<D, T> Distribution<[T; 0]> for IIDDistr<D>
where D: Distribution<T>, T: Sized,

Source§

fn sample<R>(&self, rng: &mut R) -> [T; 0]
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

impl<D, T> Distribution<[T; 1]> for IIDDistr<D>
where D: Distribution<T>, T: Sized,

Source§

fn sample<R>(&self, rng: &mut R) -> [T; 1]
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

impl<D, T> Distribution<[T; 10]> for IIDDistr<D>
where D: Distribution<T>, T: Sized,

Source§

fn sample<R>(&self, rng: &mut R) -> [T; 10]
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

impl<D, T> Distribution<[T; 11]> for IIDDistr<D>
where D: Distribution<T>, T: Sized,

Source§

fn sample<R>(&self, rng: &mut R) -> [T; 11]
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

impl<D, T> Distribution<[T; 12]> for IIDDistr<D>
where D: Distribution<T>, T: Sized,

Source§

fn sample<R>(&self, rng: &mut R) -> [T; 12]
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

impl<D, T> Distribution<[T; 13]> for IIDDistr<D>
where D: Distribution<T>, T: Sized,

Source§

fn sample<R>(&self, rng: &mut R) -> [T; 13]
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

impl<D, T> Distribution<[T; 14]> for IIDDistr<D>
where D: Distribution<T>, T: Sized,

Source§

fn sample<R>(&self, rng: &mut R) -> [T; 14]
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

impl<D, T> Distribution<[T; 15]> for IIDDistr<D>
where D: Distribution<T>, T: Sized,

Source§

fn sample<R>(&self, rng: &mut R) -> [T; 15]
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

impl<D, T> Distribution<[T; 16]> for IIDDistr<D>
where D: Distribution<T>, T: Sized,

Source§

fn sample<R>(&self, rng: &mut R) -> [T; 16]
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

impl<D, T> Distribution<[T; 17]> for IIDDistr<D>
where D: Distribution<T>, T: Sized,

Source§

fn sample<R>(&self, rng: &mut R) -> [T; 17]
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

impl<D, T> Distribution<[T; 18]> for IIDDistr<D>
where D: Distribution<T>, T: Sized,

Source§

fn sample<R>(&self, rng: &mut R) -> [T; 18]
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

impl<D, T> Distribution<[T; 19]> for IIDDistr<D>
where D: Distribution<T>, T: Sized,

Source§

fn sample<R>(&self, rng: &mut R) -> [T; 19]
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

impl<D, T> Distribution<[T; 2]> for IIDDistr<D>
where D: Distribution<T>, T: Sized,

Source§

fn sample<R>(&self, rng: &mut R) -> [T; 2]
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

impl<D, T> Distribution<[T; 20]> for IIDDistr<D>
where D: Distribution<T>, T: Sized,

Source§

fn sample<R>(&self, rng: &mut R) -> [T; 20]
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

impl<D, T> Distribution<[T; 21]> for IIDDistr<D>
where D: Distribution<T>, T: Sized,

Source§

fn sample<R>(&self, rng: &mut R) -> [T; 21]
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

impl<D, T> Distribution<[T; 22]> for IIDDistr<D>
where D: Distribution<T>, T: Sized,

Source§

fn sample<R>(&self, rng: &mut R) -> [T; 22]
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

impl<D, T> Distribution<[T; 23]> for IIDDistr<D>
where D: Distribution<T>, T: Sized,

Source§

fn sample<R>(&self, rng: &mut R) -> [T; 23]
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

impl<D, T> Distribution<[T; 24]> for IIDDistr<D>
where D: Distribution<T>, T: Sized,

Source§

fn sample<R>(&self, rng: &mut R) -> [T; 24]
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

impl<D, T> Distribution<[T; 25]> for IIDDistr<D>
where D: Distribution<T>, T: Sized,

Source§

fn sample<R>(&self, rng: &mut R) -> [T; 25]
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

impl<D, T> Distribution<[T; 26]> for IIDDistr<D>
where D: Distribution<T>, T: Sized,

Source§

fn sample<R>(&self, rng: &mut R) -> [T; 26]
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

impl<D, T> Distribution<[T; 27]> for IIDDistr<D>
where D: Distribution<T>, T: Sized,

Source§

fn sample<R>(&self, rng: &mut R) -> [T; 27]
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

impl<D, T> Distribution<[T; 28]> for IIDDistr<D>
where D: Distribution<T>, T: Sized,

Source§

fn sample<R>(&self, rng: &mut R) -> [T; 28]
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

impl<D, T> Distribution<[T; 29]> for IIDDistr<D>
where D: Distribution<T>, T: Sized,

Source§

fn sample<R>(&self, rng: &mut R) -> [T; 29]
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

impl<D, T> Distribution<[T; 3]> for IIDDistr<D>
where D: Distribution<T>, T: Sized,

Source§

fn sample<R>(&self, rng: &mut R) -> [T; 3]
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

impl<D, T> Distribution<[T; 30]> for IIDDistr<D>
where D: Distribution<T>, T: Sized,

Source§

fn sample<R>(&self, rng: &mut R) -> [T; 30]
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

impl<D, T> Distribution<[T; 31]> for IIDDistr<D>
where D: Distribution<T>, T: Sized,

Source§

fn sample<R>(&self, rng: &mut R) -> [T; 31]
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

impl<D, T> Distribution<[T; 4]> for IIDDistr<D>
where D: Distribution<T>, T: Sized,

Source§

fn sample<R>(&self, rng: &mut R) -> [T; 4]
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

impl<D, T> Distribution<[T; 5]> for IIDDistr<D>
where D: Distribution<T>, T: Sized,

Source§

fn sample<R>(&self, rng: &mut R) -> [T; 5]
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

impl<D, T> Distribution<[T; 6]> for IIDDistr<D>
where D: Distribution<T>, T: Sized,

Source§

fn sample<R>(&self, rng: &mut R) -> [T; 6]
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

impl<D, T> Distribution<[T; 7]> for IIDDistr<D>
where D: Distribution<T>, T: Sized,

Source§

fn sample<R>(&self, rng: &mut R) -> [T; 7]
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

impl<D, T> Distribution<[T; 8]> for IIDDistr<D>
where D: Distribution<T>, T: Sized,

Source§

fn sample<R>(&self, rng: &mut R) -> [T; 8]
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

impl<D, T> Distribution<[T; 9]> for IIDDistr<D>
where D: Distribution<T>, T: Sized,

Source§

fn sample<R>(&self, rng: &mut R) -> [T; 9]
where R: Rng + ?Sized,

Generate a random value of T, using rng as the source of randomness.
Source§

fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
where R: Rng, Self: Sized,

Create an iterator that generates random values of T, using rng as the source of randomness. Read more
Source§

impl<D: Hash> Hash for IIDDistr<D>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<D: PartialEq> PartialEq for IIDDistr<D>

Source§

fn eq(&self, other: &IIDDistr<D>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<D: Copy> Copy for IIDDistr<D>

Source§

impl<D: Eq> Eq for IIDDistr<D>

Source§

impl<D> StructuralPartialEq for IIDDistr<D>

Auto Trait Implementations§

§

impl<D> Freeze for IIDDistr<D>
where D: Freeze,

§

impl<D> RefUnwindSafe for IIDDistr<D>
where D: RefUnwindSafe,

§

impl<D> Send for IIDDistr<D>
where D: Send,

§

impl<D> Sync for IIDDistr<D>
where D: Sync,

§

impl<D> Unpin for IIDDistr<D>
where D: Unpin,

§

impl<D> UnwindSafe for IIDDistr<D>
where D: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V