Struct rand_distr::Binomial
source · pub struct Binomial { /* private fields */ }
Expand description
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§
Trait Implementations§
source§impl Distribution<u64> for Binomial
impl Distribution<u64> for Binomial
impl Copy for Binomial
Auto Trait Implementations§
impl RefUnwindSafe for Binomial
impl Send for Binomial
impl Sync for Binomial
impl Unpin for Binomial
impl UnwindSafe for Binomial
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more