Struct rand_distr::Triangular [−][src]
pub struct Triangular<N> { /* fields omitted */ }
The triangular distribution.
A continuous probability distribution parameterised by a range, and a mode (most likely value) within that range.
The probability density function is triangular. For a similar distribution
with a smooth PDF, see the Pert
distribution.
Example
use rand_distr::{Triangular, Distribution}; let d = Triangular::new(0., 5., 2.5).unwrap(); let v = d.sample(&mut rand::thread_rng()); println!("{} is from a triangular distribution", v);
Implementations
impl<N: Float> Triangular<N> where
Standard: Distribution<N>,
[src]
impl<N: Float> Triangular<N> where
Standard: Distribution<N>,
[src]pub fn new(min: N, max: N, mode: N) -> Result<Triangular<N>, TriangularError>
[src]
Set up the Triangular distribution with defined min
, max
and mode
.
Trait Implementations
impl<N: Clone> Clone for Triangular<N>
[src]
impl<N: Clone> Clone for Triangular<N>
[src]fn clone(&self) -> Triangular<N>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<N: Float> Distribution<N> for Triangular<N> where
Standard: Distribution<N>,
[src]
impl<N: Float> Distribution<N> for Triangular<N> where
Standard: Distribution<N>,
[src]impl<N: Copy> Copy for Triangular<N>
[src]
Auto Trait Implementations
impl<N> RefUnwindSafe for Triangular<N> where
N: RefUnwindSafe,
N: RefUnwindSafe,
impl<N> Send for Triangular<N> where
N: Send,
N: Send,
impl<N> Sync for Triangular<N> where
N: Sync,
N: Sync,
impl<N> Unpin for Triangular<N> where
N: Unpin,
N: Unpin,
impl<N> UnwindSafe for Triangular<N> where
N: UnwindSafe,
N: UnwindSafe,