Random Sampling Explained: Shuffles, Picks, and Fair Draws
Random sampling explained: why unbiased randomness matters, how a Fisher-Yates shuffle works, the difference between sampling with and without replacement, simple random versus stratified sampling, and common ways draws become biased. With worked examples and a free randomizer tool.
Randomness is not "anything goes" — a good random sample is one where every item had an equal, independent chance of being chosen. That property is what lets a poll of 1,000 people describe a country, or a shuffled playlist play every song without repeating. The mechanics are simple, but the bias traps are everywhere.
1. What "unbiased" actually means
A random sample is unbiased when two conditions hold: every possible item has the same probability of being chosen, and every choice is independent of the others. If some items are more likely than others, or if picking one changes the odds for the rest, the sample is biased and its results do not generalize to the whole group.
unbiased: P(each item chosen) equal, and choices independent
This is why "ask my friends" is not a random sample of the population — your friends are not equally likely to be chosen, and their answers are not independent of each other. Randomness is a property of the selection process, not of the outcome; a shuffled list that happens to look ordered is still random if the shuffle was fair.
2. The Fisher-Yates shuffle: an unbiased shuffle
The Fisher-Yates shuffle is the standard algorithm for producing a uniformly random ordering. It walks through the list once: at each position i, it picks a random index j between i and the end and swaps the two items. After one pass, every one of the n! possible orderings is equally likely.
for i from 0 to n-2:
j = random integer in [i, n-1]
swap(list[i], list[j])
A subtle but common bug is picking j over the whole list at every step instead of from i onward. That produces a biased shuffle where some orderings are far more likely than others. The range of j is what guarantees uniformity, so getting it exactly right matters.
3. Sampling with and without replacement
Two flavors of "pick N random items" differ in whether repeats are allowed. With replacement, an item can be picked more than once — like rolling a die repeatedly, where a 6 can come up twice in a row. Without replacement, each item is removed once chosen, so there are no repeats — like dealing cards from a deck.
with replacement: items can repeat (independent draws)
without replacement: items are distinct (deck-deal model)
Most "pick N random items from a list" tools use without replacement when you want N distinct results and with replacement when repeats are allowed. The choice depends on the question: a random sample of survey respondents is without replacement (you don't survey the same person twice), but simulating dice rolls is with replacement.
4. Simple random versus stratified sampling
Simple random sampling draws uniformly from the whole group, which is unbiased but can miss small subgroups by chance. Stratified sampling first splits the group into strata (e.g. by region or age band) and then draws a random sample from each stratum, guaranteeing every subgroup is represented proportionally. Stratified is more precise when the subgroups matter; simple random is simpler and unbiased when they do not.
The trade-off is precision versus simplicity. For a fair shuffle or a quick random pick, simple random sampling is exactly right. For a national poll that must reflect every region, stratified sampling prevents a lucky draw from a small region being over- or under-represented.
5. Pseudo-random versus true randomness
Computers generate "random" numbers from a deterministic formula (a pseudo-random number generator, or PRNG), not from physical randomness. Modern PRNGs have periods so long and statistics so even that for shuffles, picks, and simulations the output is indistinguishable from true randomness. For almost every everyday use — shuffling a playlist, picking a winner, sampling a list — pseudo-random is more than good enough.
The one place it is not good enough is cryptography. A predictable generator would let an attacker who knows the algorithm reproduce your keys, so cryptography requires true hardware randomness (or a cryptographically secure PRNG seeded from it). For sampling and shuffling, that level of unpredictability is unnecessary — uniformity and independence are what matter, and a good PRNG delivers both.
Try it yourself
The Randomizer shuffles a list into a random order or picks N random items, with optional dedupe and separator handling, using an unbiased Fisher-Yates shuffle. For a quick fair draw, the Dice Roller generates random dice results, and the Probability Calculator works out the odds that a random draw produces a given outcome.