General a small sample of size M out of a huge population of size N.
1 2 3
The size of the population.
The sample size.
HSEL.bigz generates a sample of size M from a population of size N, with space complexity linear in M.
rejsample is similar to
HSEL.bigz, but implemented using direct rejection through
sample1 generates one number of 0 to N-1 using simple rejection and
bigz vector of length
N, between 1 and N.
bigz integer, between 0 and N-1.
rejsample can be very slow when M is large.
Jarmo Ernvall and Olli Nevalainen. 1982. An Algorithm for Unbiased Random Sampling. THE COMPUTER JOURNAL, VOL. 25, NO. 1, 45–47
1 2 3
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.