pub struct Pert<N> { /* private fields */ }
Expand description
The PERT distribution.
Similar to the Triangular
distribution, the PERT distribution is
parameterised by a range and a mode within that range. Unlike the
Triangular
distribution, the probability density function of the PERT
distribution is smooth, with a configurable weighting around the mode.
§Example
use rand_distr::{Pert, Distribution};
let d = Pert::new(0., 5., 2.5).unwrap();
let v = d.sample(&mut rand::thread_rng());
println!("{} is from a PERT distribution", v);
Implementations§
Source§impl<N: Float> Pert<N>
impl<N: Float> Pert<N>
Sourcepub fn new(min: N, max: N, mode: N) -> Result<Pert<N>, PertError>
pub fn new(min: N, max: N, mode: N) -> Result<Pert<N>, PertError>
Set up the PERT distribution with defined min
, max
and mode
.
This is equivalent to calling Pert::new_shape
with shape == 4.0
.
Sourcepub fn new_with_shape(
min: N,
max: N,
mode: N,
shape: N,
) -> Result<Pert<N>, PertError>
pub fn new_with_shape( min: N, max: N, mode: N, shape: N, ) -> Result<Pert<N>, PertError>
Set up the PERT distribution with defined min
, max
, mode
and
shape
.
Trait Implementations§
Source§impl<N: Float> Distribution<N> for Pert<N>
impl<N: Float> Distribution<N> for Pert<N>
impl<N: Copy> Copy for Pert<N>
Auto Trait Implementations§
impl<N> Freeze for Pert<N>where
N: Freeze,
impl<N> RefUnwindSafe for Pert<N>where
N: RefUnwindSafe,
impl<N> Send for Pert<N>where
N: Send,
impl<N> Sync for Pert<N>where
N: Sync,
impl<N> Unpin for Pert<N>where
N: Unpin,
impl<N> UnwindSafe for Pert<N>where
N: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more