The hypergeometric distribution models a picking problem. Given a number of tagged and untagged objects,
the number of tagged objects selected out of a fixed number of selections follows a hypergeometric
distribution. For example, if a bag contains 8 white and 12 black balls, and 6 balls are taken out of the bag at
random, then the number of white balls chosen follows a hypergeometric distribution.
The hypergeometric distribution is related to the The Binomial Distribution.
The main difference is that the binomial distribution uses selection with replacement, whereas the
hypergeometric distribution uses selection without replacement.
The hypergeometric distribution has three parameters: the number of tagged objects, the number of
untagged objects, and the number of selections.
Examples of the hypergeometric distribution are:
- In quality control, the number of defective products out of a sample of fixed size follows a
- In biology, the size of an animal population can be estimated by first tagging a known number of animals, and a
short time later recapturing a fixed number of animals. The number of tagged animals in the recaptured samples
follows a hypergeometric distribution.
The Hypergeometric distribution is implemented by the HypergeometricDistribution class. It has one
constructor with three parameters. The first parameter is an integer that specifies the number of items in the
untagged population. The second parameter specifies the number of items in the tagged population. The thirs parameter
specifies the number of samples drawn from the total population. The following constructs a hypergeometric
distribution for 20 tagged items, 10 untagged items, and 15 samples:
HypergeometricDistribution hyper = new HypergeometricDistribution(20, 10, 15);
|Visual Basic ||Copy|
Dim hyper As HypergeometricDistribution = New HypergeometricDistribution(20, 10, 15)
The HypergeometricDistribution class has three specific properties. TaggedPopulation returns the
number of items in the tagged population. UntaggedPopulation returns
the number of items in the untagged population. NumberOfSamples returns the
number of samples drawn from the entire population.
HypergeometricDistribution has one static (Shared in Visual Basic) method, Sample, which
generates a random variate using a user-supplied uniform random number generator. The first parameter is the random
number generator. The remaining 3 parameters correspond to the parameters of the constructor.
MersenneTwister random = new MersenneTwister();
double variate = HypergeometricDistribution.GetRandomVariate(random, 20, 10, 15);
|Visual Basic ||Copy|
Dim random As MersenneTwister = New MersenneTwister()
Dim variate As Double = HypergeometricDistribution.GetRandomVariate(random, 20, 10, 15)
The above example uses the MersenneTwister class to generate uniform random numbers.
For details of the properties and methods common to all discrete probability distribution classes, see the topic