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\).

Note that \(p(x)\) is non-zero only for
\(\max(0, k-n) \le x \le \min(k, m)\).

With \(p := m/(m+n)\) (hence \(Np = N \times p\) in the
reference's notation), the first two moments are mean
$$E[X] = \mu = k p$$ and variance
$$\mbox{Var}(X) = k p (1 - p) \frac{m+n-k}{m+n-1},$$
which shows the closeness to the Binomial\((k,p)\) (where the
hypergeometric has smaller variance unless \(k = 1\)).

The quantile is defined as the smallest value \(x\) such that
\(F(x) \ge p\), where \(F\) is the distribution function.

If one of \(m, n, k\), exceeds `.Machine$integer.max`

,
currently the equivalent of `qhyper(runif(nn), m,n,k)`

is used,
when a binomial approximation may be considerably more efficient.