Struct rand::distributions::Poisson [−][src]
pub struct Poisson { /* fields omitted */ }The Poisson distribution Poisson(lambda).
This distribution has a density function:
f(k) = lambda^k * exp(-lambda) / k! for k >= 0.
Example
use rand::distributions::{Poisson, Distribution}; let poi = Poisson::new(2.0); let v = poi.sample(&mut rand::thread_rng()); println!("{} is from a Poisson(2) distribution", v);
Methods
impl Poisson[src]
impl Poissonpub fn new(lambda: f64) -> Poisson[src]
pub fn new(lambda: f64) -> PoissonConstruct a new Poisson with the given shape parameter
lambda. Panics if lambda <= 0.
Trait Implementations
impl Clone for Poisson[src]
impl Clone for Poissonfn clone(&self) -> Poisson[src]
fn clone(&self) -> PoissonReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)1.0.0
[src]Performs copy-assignment from source. Read more
impl Copy for Poisson[src]
impl Copy for Poissonimpl Debug for Poisson[src]
impl Debug for Poissonfn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl Distribution<u64> for Poisson[src]
impl Distribution<u64> for Poissonfn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> u64[src]
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> u64Generate a random value of T, using rng as the source of randomness.
ⓘImportant traits for DistIter<'a, D, R, T>fn sample_iter<'a, R>(&'a self, rng: &'a mut R) -> DistIter<'a, Self, R, T> where
Self: Sized,
R: Rng, [src]
ⓘImportant traits for DistIter<'a, D, R, T>
fn sample_iter<'a, R>(&'a self, rng: &'a mut R) -> DistIter<'a, Self, R, T> where
Self: Sized,
R: Rng, Create an iterator that generates random values of T, using rng as the source of randomness. Read more