Struct std::rand::distributions::Exp1

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).

Example

use std::rand::distributions::Exp1;

fn main() {
    let exp2 = (*rand::random::<Exp1>()) * 0.5;
    printfln!("%f is from a Exp(2) distribution", exp2);
}

Trait Implementations

impl Rand for Exp1

fn rand<R: Rng>(rng: &mut R) -> Exp1

Generates a random instance of this type using the specified source of randomness