Struct rand::distributions::Dirichlet
source · [−]pub struct Dirichlet { /* private fields */ }
Expand description
The dirichelet distribution Dirichlet(alpha)
.
The Dirichlet distribution is a family of continuous multivariate probability distributions parameterized by a vector alpha of positive reals. It is a multivariate generalization of the beta distribution.
Example
use rand::prelude::*;
use rand::distributions::Dirichlet;
let dirichlet = Dirichlet::new(vec![1.0, 2.0, 3.0]);
let samples = dirichlet.sample(&mut rand::thread_rng());
println!("{:?} is from a Dirichlet([1.0, 2.0, 3.0]) distribution", samples);
Implementations
Trait Implementations
sourceimpl Distribution<Vec<f64, Global>> for Dirichlet
impl Distribution<Vec<f64, Global>> for Dirichlet
sourcefn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Vec<f64>
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Vec<f64>
Generate a random value of T
, using rng
as the source of randomness.
sourcefn sample_iter<'a, R>(&'a self, rng: &'a mut R) -> DistIter<'a, Self, R, T>ⓘNotable traits for DistIter<'a, D, R, T>impl<'a, D, R, T> Iterator for DistIter<'a, D, R, T> where
D: Distribution<T>,
R: Rng + 'a, type Item = T;
where
Self: Sized,
R: Rng,
fn sample_iter<'a, R>(&'a self, rng: &'a mut R) -> DistIter<'a, Self, R, T>ⓘNotable traits for DistIter<'a, D, R, T>impl<'a, D, R, T> Iterator for DistIter<'a, D, R, T> where
D: Distribution<T>,
R: Rng + 'a, type Item = T;
where
Self: Sized,
R: Rng,
D: Distribution<T>,
R: Rng + 'a, type Item = T;
Create an iterator that generates random values of T
, using rng
as
the source of randomness. Read more
Auto Trait Implementations
impl RefUnwindSafe for Dirichlet
impl Send for Dirichlet
impl Sync for Dirichlet
impl Unpin for Dirichlet
impl UnwindSafe for Dirichlet
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more