Calculates on this device. File exports run online.
Random Sampling Tool
Paste a list or give a range of numbers and draw a simple random sample, with or without replacement. Draw every k-th unit after a random start, split a sample over strata in proportion to their sizes (or equally, or by Neyman allocation), or draw clusters and then units in them. Every sample shows its seed and method, so anyone can draw the same sample again. The tool also works out the sample size you need for a survey and counts the possible samples.
Enter your values
Check these values
Your values are worked out in this browser. They are not sent to a server.
Your result will show here
Fill in the values, then choose the button below them.
Your result
How it was worked out
How to use it
- Choose Simple random sample, paste your list (one item on each line) or give a range, set the sample size and press Draw the sample.
- Keep the seed shown with the result: the same seed, list and size always give the same sample. Leave the seed empty to get a new one.
- For groups, choose Stratified sample and give the size of each group; for schools, villages or batches, choose Two-stage (cluster) sample.
- Choose Sample size to find how many people or items to sample for a margin of error.
The method, stated
- Random numbers come from xoshiro128**, seeded by SplitMix32 from the seed. A whole number from 0 to m − 1 is drawn by rejecting values above the largest multiple of m, so there is no bias.
- Without replacement the sample is a partial Fisher–Yates shuffle: every set of n items is equally likely. With replacement each draw is independent.
- Systematic: interval k = N ÷ n (a fraction is kept) and a random start between 0 and k; units ⌊start + i × k⌋ + 1.
- Stratified: n is split by largest remainders, never above a stratum’s size; each stratum is sampled with the seed plus its number.
- This generator is made for repeatable samples, not for secrets: do not use it for passwords or draws where someone could profit from guessing the seed.
Sample size
For a share: n₀ = z² × p × (1 − p) ÷ e²; for a mean: n₀ = (z × σ ÷ e)². With a population of N, n = n₀ ÷ (1 + (n₀ − 1) ÷ N). At 95% confidence and ±5 points, a share needs 385 people from a large population.