pub struct Exp { /* fields omitted */ }
The exponential distribution Exp(lambda)
.
This distribution has density function: f(x) = lambda * exp(-lambda * x)
for x > 0
.
Note that Exp1
is an optimised implementation for lambda = 1
.
use rand::distributions::{Exp, Distribution};
let exp = Exp::new(2.0);
let v = exp.sample(&mut rand::thread_rng());
println!("{} is from a Exp(2) distribution", v);
Construct a new Exp
with the given shape parameter
lambda
. Panics if lambda <= 0
.
Formats the value using the given formatter. Read more
Generate a random value of T
, using rng
as the source of randomness.
pub fn sample_iter<R>(&'a self, rng: &'a mut R) -> DistIter<'a, Self, R, T>ⓘNotable traits for DistIter<'a, D, R, T>
impl<'a, D, R, T> Iterator for DistIter<'a, D, R, T> where
R: Rng + 'a,
D: Distribution<T>, type Item = T;
where
R: Rng,
[src]
Create an iterator that generates random values of T
, using rng
as
the source of randomness. Read more
impl<T> Any for T where
T: 'static + ?Sized,
[src]
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
impl<T, U> Into<U> for T where
U: From<T>,
[src]
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
The type returned in the event of a conversion error.
The type returned in the event of a conversion error.