Random Sampling Calculator
Draw one or many random values from any range — with or without repeats — for a random number, a simple random sample, or a full shuffle. See exactly where your draws land with a visual, plus the probability of repeats when repeats are allowed.
Background
A single random number, a simple random sample of a class, a shuffled deck, and a series of dice rolls are all the same underlying operation: draw k values from a population of N possible values, either allowing repeats (with replacement) or not (without replacement). This calculator handles all of them through that one mechanic — set k = 1 for a single random number, or k = N without replacement for a full shuffle.
How to use this calculator
- Set a minimum and maximum value to define the range of possible values (the "population").
- Set a sample size — how many values to draw. Use 1 for a single random number.
- Choose whether repeats are allowed ("with replacement," like dice) or not ("without replacement," like drawing names).
- Click Draw to get your result, a visual showing where the draws landed, and the full step-by-step logic.
How this calculator works
- With replacement: each draw is an independent, equally likely choice from the entire range — the same value can come up more than once, exactly like rolling a die repeatedly.
- Without replacement: each draw removes that value from further consideration, so every result in the sample is guaranteed to be distinct — like drawing names from a hat without putting them back.
- Seeds: computers generate "randomness" using a deterministic formula started from a seed value. Leave the seed blank for a fresh, non-reproducible draw, or enter one to get the same sequence every time — useful for building a repeatable classroom example.
Formula & Equations Used
Population size: N = max − min + 1
Probability of at least one repeat (with replacement, k draws from N values): P = 1 − (N/N) × ((N−1)/N) × ... × ((N−k+1)/N) — the same logic as the classic "birthday problem."
Example Problems & Step-by-Step Solutions
Example 1 — A single random number
Pick one random number between 1 and 100.
- N = 100 − 1 + 1 = 100 possible values.
- Draw k = 1 value — with or without replacement makes no difference when k = 1.
Example 2 — A simple random sample
Randomly select 10 students from a class roster of 30, numbered 1–30.
- N = 30, k = 10, drawn without replacement — no student should be picked twice.
- Sorting the 10 results makes the roster numbers easy to read off in order.
Example 3 — Repeated independent trials
Simulate rolling a 6-sided die 20 times.
- N = 6, k = 20, drawn with replacement — every roll can land on any face again.
- Since k > N, at least one repeat is guaranteed (P = 100%) — with only 6 faces and 20 rolls, some number must repeat.
Example 4 — A full shuffle
Shuffle the numbers 1 through 52 (like a deck of cards).
- N = 52, k = 52, drawn without replacement — every value appears exactly once, just reordered.
Frequently Asked Questions
What's the difference between sampling with and without replacement?
With replacement, every draw is independent and can repeat a previous value — appropriate for dice, coin flips, or any repeated independent trial. Without replacement, each draw is removed from the pool, so results are guaranteed distinct — appropriate for selecting people, cards, or unique IDs from a population.
Why does a small random sample sometimes look uneven?
Genuine randomness doesn't guarantee even spacing — clumps and gaps are expected with small samples. Only with a large number of draws does the distribution reliably start to look flat across the range.
Is a computer's "random" number truly random?
Usually not — it's pseudorandom, generated by a deterministic formula from a seed value. This calculator uses genuinely unpredictable browser randomness by default, but lets you supply your own seed for a reproducible sequence when that's useful for teaching or grading.
Can I use this to shuffle a list, like a deck of cards?
Yes — set the range to match the number of items (1 to 52 for a standard deck), set the sample size equal to the range, and draw without replacement. The result is a complete, randomly ordered permutation.