pub struct Hypergeometric { /* private fields */ }
Expand description
The hypergeometric distribution Hypergeometric(N, K, n)
.
This is the distribution of successes in samples of size n
drawn without
replacement from a population of size N
containing K
success states.
It has the density function:
f(k) = binomial(K, k) * binomial(N-K, n-k) / binomial(N, n)
,
where binomial(a, b) = a! / (b! * (a - b)!)
.
The binomial distribution is the analogous distribution for sampling with replacement. It is a good approximation when the population size is much larger than the sample size.
§Example
use rand_distr::{Distribution, Hypergeometric};
let hypergeo = Hypergeometric::new(60, 24, 7).unwrap();
let v = hypergeo.sample(&mut rand::thread_rng());
println!("{} is from a hypergeometric distribution", v);
Implementations§
Trait Implementations§
Source§impl Clone for Hypergeometric
impl Clone for Hypergeometric
Source§fn clone(&self) -> Hypergeometric
fn clone(&self) -> Hypergeometric
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for Hypergeometric
impl Debug for Hypergeometric
Source§impl Distribution<u64> for Hypergeometric
impl Distribution<u64> for Hypergeometric
impl Copy for Hypergeometric
Auto Trait Implementations§
impl Freeze for Hypergeometric
impl RefUnwindSafe for Hypergeometric
impl Send for Hypergeometric
impl Sync for Hypergeometric
impl Unpin for Hypergeometric
impl UnwindSafe for Hypergeometric
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 120 bytes