## Hyper geometric Distribution

For a h(k;n;m;r) distributed random variable X with fixed n, m and r you may calculate a histogram and a table of values for the probabilities P( X = k ).

This routine is especially useful, because hardly any tables for hyper geometric distribution exist due to the four input variables, and the calculation of probabilities requires a great deal of expenditure.

### Theory:

A container is filled with m balls, r of which are red. If n balls are drawn without replacement, then the random variable X tells, how many red balls were drawn. The probability of k of the balls drawn being red, is characterized by P(X=k) = h(k,n,m,r).

The amount of balls drawn n, the total amount m and the amount of red balls r are entered. As the drawing proceeds without discarding, verify that n<m, and also r<m.

### Example:

```  n = 20;    m = 100;    r = 50

k              P(X=k)       P(0<=X<=k)
----------     ----------     ----------
0            0,00000009     0,00000009
1            0,00000284     0,00000292
2            0,00004126     0,00004419
3            0,00036010     0,00040429
4            0,00211560     0,00251989
5            0,00889760     0,01141749
6            0,02780501     0,03922250
7            0,06613084     0,10535334
8            0,12160243     0,22695577
9            0,17460862     0,40156439
10           0,19687122     0,59843561
11           0,17460862     0,77304423
12           0,12160243     0,89464666
13           0,06613084     0,96077750
14           0,02780501     0,98858251
15           0,00889760     0,99748011
16           0,00211560     0,99959571
17           0,00036010     0,99995581
18           0,00004126     0,99999708
19           0,00000284     0,99999991
20           0,00000009     1,00000000
----------     ----------     ----------
P(0<=k<=20) =  1,00000000``` 