The Hypergeometric distribution is used for sampling without
replacement. The density of this distribution with parameters
m, n and k (named \(Np\), \(N-Np\), and
\(n\), respectively in the reference below) is given by
$$
p(x) = \left. {m \choose x}{n \choose k-x} \right/ {m+n \choose k}
$$
for \(x = 0, \ldots, k\).
The generation algorithm uses guide table based inversion. The parameters
lb and ub can be used to generate variates from
the Hypergeometric distribution truncated to the interval (lb,ub).