Struct ndarray_rand::rand_distr::Triangular
source · pub struct Triangular<F>{ /* private fields */ }
Expand description
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§
source§impl<F> Triangular<F>
impl<F> Triangular<F>
sourcepub fn new(min: F, max: F, mode: F) -> Result<Triangular<F>, TriangularError>
pub fn new(min: F, max: F, mode: F) -> Result<Triangular<F>, TriangularError>
Set up the Triangular distribution with defined min
, max
and mode
.
Trait Implementations§
source§impl<F> Clone for Triangular<F>
impl<F> Clone for Triangular<F>
source§fn clone(&self) -> Triangular<F>
fn clone(&self) -> Triangular<F>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<F> Debug for Triangular<F>
impl<F> Debug for Triangular<F>
source§impl<F> Distribution<F> for Triangular<F>
impl<F> Distribution<F> for Triangular<F>
impl<F> Copy for Triangular<F>
Auto Trait Implementations§
impl<F> Freeze for Triangular<F>where
F: Freeze,
impl<F> RefUnwindSafe for Triangular<F>where
F: RefUnwindSafe,
impl<F> Send for Triangular<F>where
F: Send,
impl<F> Sync for Triangular<F>where
F: Sync,
impl<F> Unpin for Triangular<F>where
F: Unpin,
impl<F> UnwindSafe for Triangular<F>where
F: 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)