g05ndc selects
$m$ elements from a population vector
ipop of length
$n$ and places them in a sample vector
isampl. Their order in
ipop will be preserved in
isampl. Each of the
$\left(\begin{array}{c}n\\ m\end{array}\right)$ possible combinations of elements of
isampl may be regarded as being equally probable.
One of the initialization functions
g05kfc (for a repeatable sequence if computed sequentially) or
g05kgc (for a nonrepeatable sequence) must be called prior to the first call to
g05ndc.
Not applicable.
Please consult the
X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this function. Please also consult the
Users' Note for your implementation for any additional implementationspecific information.
In order to sample other kinds of vectors, or matrices of higher dimension, the following technique may be used:

(a)set ${\mathbf{ipop}}\left[\mathit{i}1\right]=\mathit{i}$, for $\mathit{i}=1,2,\dots ,n$;

(b)use g05ndc to take a sample from ipop and put it into isampl;

(c)use the contents of isampl as a set of indices to access the relevant vector or matrix.
In order to divide a population into several groups,
g05ncc is more efficient.
In the example program random samples of size
$1,2,\dots ,8$ are selected from a vector containing the first eight positive integers in ascending order. The samples are generated and printed for each sample size by a call to
g05ndc after initialization by
g05kfc.
None.