pub struct Exp1(f64);
A wrapper around an f64
to generate Exp(1) random numbers. Dividing by
the desired rate lambda
will give Exp(lambda) distributed random
numbers.
Note that this has to be unwrapped before use as an f64
(using either
*
or cast::transmute
is safe).
use std::rand::distributions::Exp1;
fn main() {
let exp2 = (*rand::random::<Exp1>()) * 0.5;
printfln!("%f is from a Exp(2) distribution", exp2);
}
impl Rand for Exp1
Prefix searches with a type followed by a colon (e.g.
fn:
) to restrict the search to a given type.
Accepted types are: fn
, mod
,
struct
(or str
), enum
,
trait
, typedef
(or
tdef
).