Struct ndarray_rand::rand_distr::Hypergeometric[][src]

pub struct Hypergeometric { /* fields omitted */ }

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 analagous 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

impl Hypergeometric[src]

pub fn new(
    total_population_size: u64,
    population_with_feature: u64,
    sample_size: u64
) -> Result<Hypergeometric, Error>
[src]

Constructs a new Hypergeometric with the shape parameters N = total_population_size, K = population_with_feature, n = sample_size.

Trait Implementations

impl Clone for Hypergeometric[src]

impl Copy for Hypergeometric[src]

impl Debug for Hypergeometric[src]

impl Distribution<u64> for Hypergeometric[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,