Struct rand_distr::Triangular [−][src]
pub struct Triangular<F> where
F: Float,
Standard: Distribution<F>, { /* 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<F> Triangular<F> where
F: Float,
Standard: Distribution<F>,
[src]
impl<F> Triangular<F> where
F: Float,
Standard: Distribution<F>,
[src]pub fn new(min: F, max: F, mode: F) -> Result<Triangular<F>, TriangularError>
[src]
Set up the Triangular distribution with defined min
, max
and mode
.
Trait Implementations
impl<F: Clone> Clone for Triangular<F> where
F: Float,
Standard: Distribution<F>,
[src]
impl<F: Clone> Clone for Triangular<F> where
F: Float,
Standard: Distribution<F>,
[src]fn clone(&self) -> Triangular<F>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<F: Debug> Debug for Triangular<F> where
F: Float,
Standard: Distribution<F>,
[src]
impl<F: Debug> Debug for Triangular<F> where
F: Float,
Standard: Distribution<F>,
[src]impl<F> Distribution<F> for Triangular<F> where
F: Float,
Standard: Distribution<F>,
[src]
impl<F> Distribution<F> for Triangular<F> where
F: Float,
Standard: Distribution<F>,
[src]impl<F: Copy> Copy for Triangular<F> where
F: Float,
Standard: Distribution<F>,
[src]
F: Float,
Standard: Distribution<F>,
Auto Trait Implementations
impl<F> RefUnwindSafe for Triangular<F> where
F: RefUnwindSafe,
F: RefUnwindSafe,
impl<F> Send for Triangular<F> where
F: Send,
F: Send,
impl<F> Sync for Triangular<F> where
F: Sync,
F: Sync,
impl<F> Unpin for Triangular<F> where
F: Unpin,
F: Unpin,
impl<F> UnwindSafe for Triangular<F> where
F: UnwindSafe,
F: UnwindSafe,