Struct rand_distr::Binomial [−][src]
pub struct Binomial { /* fields omitted */ }
The binomial distribution Binomial(n, p)
.
This distribution has density function:
f(k) = n!/(k! (n-k)!) p^k (1-p)^(n-k)
for k >= 0
.
Example
use rand_distr::{Binomial, Distribution}; let bin = Binomial::new(20, 0.3).unwrap(); let v = bin.sample(&mut rand::thread_rng()); println!("{} is from a binomial distribution", v);
Implementations
impl Binomial
[src]
impl Binomial
[src]