pub struct Exp<F>{ /* private fields */ }Expand description
The exponential distribution Exp(λ).
The exponential distribution is a continuous probability distribution
with rate parameter λ (lambda). It describes the time between events
in a Poisson process, i.e. a process in which
events occur continuously and independently at a constant average rate.
See Exp1 for an optimised implementation for λ = 1.
§Density function
f(x) = λ * exp(-λ * x) for x > 0, when λ > 0.
For λ = 0, all samples yield infinity (because a Poisson process
with rate 0 has no events).
§Plot
The following plot illustrates the exponential distribution with
various values of λ.
The λ parameter controls the rate of decay as x approaches infinity,
and the mean of the distribution is 1/λ.
§Example
use rand_distr::{Exp, Distribution};
let exp = Exp::new(2.0).unwrap();
let v = exp.sample(&mut rand::rng());
println!("{} is from a Exp(2) distribution", v);Implementations§
Trait Implementations§
Source§impl<'de, F> Deserialize<'de> for Exp<F>
 
impl<'de, F> Deserialize<'de> for Exp<F>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
    __D: Deserializer<'de>,
 
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
    __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<F> Distribution<F> for Exp<F>
 
impl<F> Distribution<F> for Exp<F>
impl<F> Copy for Exp<F>
impl<F> StructuralPartialEq for Exp<F>
Auto Trait Implementations§
impl<F> Freeze for Exp<F>where
    F: Freeze,
impl<F> RefUnwindSafe for Exp<F>where
    F: RefUnwindSafe,
impl<F> Send for Exp<F>where
    F: Send,
impl<F> Sync for Exp<F>where
    F: Sync,
impl<F> Unpin for Exp<F>where
    F: Unpin,
impl<F> UnwindSafe for Exp<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