List Randomizer
Paste any list, one item per line, and put it in a new random order with one click, or pick a random sample of N different items from it. Copy the result or download it as a text file. Your list is not uploaded.
1. Your list
Commas inside a line are kept, so "Smith, John" stays one item. Use "Split on commas" if you pasted a comma-separated list. The list is saved only in this browser and never uploaded; "Clear list" removes it.
2. Shuffle or pick a sample
3. Result
4. History (last 10 results)
No results yet. Every shuffle and sample you make appears here, newest first.
History is saved in this browser only, so a reload does not lose a draw you just made. Anyone using the same browser profile can see it; "Clear history" removes it.
Runs on your device. Nothing you type or record is uploaded. Keeps working without a connection while the page is open. Works with touch. Saves your list, the numbering choice, N and the last 10 results on this device; Clear list and Clear history remove them.
Added
How to use the list randomizer
- Type or paste your items into the list, one item per line. An item can be a name, a task, a quiz question or a number. Blank lines are dropped and extra spaces around each line are trimmed. A comma inside a line is kept as part of the item. There is no fixed limit on the number of lines.
- If your items are on a single line separated by commas, press Split on commas to turn each piece into its own line.
- Press Shuffle list to get the whole list in a new random order. Use Shuffle again as often as you like; every press is a new, independent shuffle.
- Or enter a number N and press Pick N at random to draw N different items, shown in random order. N must be a whole number from 1 up to the length of the list.
- Copy the result, download it as a text file or print it. Use result as the new list replaces your list with the result, so you can narrow a draw down in rounds, for example 10 finalists first and then 3 winners from them.
Shuffle versus sample. A shuffle keeps every item and only changes the order. A sample keeps just N items, and no line can be picked twice. If you typed the same text on two lines, those count as two items until you press "Remove duplicates". A sample of N from a list of N is the same as a shuffle.
What makes a shuffle fair
A list of n items can be arranged in n! different orders
(n × (n − 1) × ... × 1). A fair shuffle makes each of those orders equally likely.
This tool uses the Fisher–Yates method. Start at the last position of the list, pick a random
position anywhere from the first one up to and including the current one, swap the two items,
then move one step towards the front and repeat until you reach the start. Every sequence of
random choices leads to exactly one order, and every order is reached by exactly one
sequence, so no order is favoured.
The random choices come from crypto.getRandomValues, the cryptographic random
source built into your browser and fed by your operating system. A plain remainder would
make some positions very slightly more likely, so values that would cause that bias are
thrown away and drawn again (rejection sampling). The result is computer randomness rather
than a physical draw, but it cannot be predicted in practice. If a browser has no
cryptographic source, the tool falls back to the ordinary Math.random function,
which is fine for a classroom but not designed for security.
The Random Group Generator shuffles names the same way. The Random Name Picker uses the same random source and bias correction to draw one name at a time.
Why sorting by a random number or shuffling by hand is weaker
- Random comparisons. The popular one-line trick of sorting with a comparison that randomly says "before" or "after" breaks the rules sorting methods rely on, and the resulting orders are measurably uneven. Some orders turn up more often than others.
- Random keys. Giving each item its own random number and sorting by it can be fair, but only when the numbers are distinct and well drawn. Ties or low-quality numbers bring a bias back, and it does more work than Fisher–Yates for no gain.
- By hand. Drawing slips from a hat is fair if they are well mixed, but a deck of cards needs about seven good riffle shuffles to be well mixed, and most people stop earlier. The order also tends to keep traces of the starting order.
Examples
Example 1: four items. A list of 4 items has 4! = 4 × 3 × 2 × 1 = 24
possible orders. Over many presses of "Shuffle list" each of the 24 orders shows up about
1 time in 24, roughly 4.2 % of the time.
Example 2: ten items. The sample list has 10 items, so there are
10! = 3,628,800 orders. The same order comes up twice in a row only about once
in 3.6 million shuffles.
Example 3: three winners from 50. Paste 50 names and pick N = 3. There are
50 × 49 × 48 = 117,600 ordered results, and because 3 winners can be listed in
3! = 6 orders, 117,600 ÷ 6 = 19,600 different groups of winners. Each
group is equally likely, and the first name shown is as likely to be any of the 50 as the
last.
Example 4: a comma-separated line. The single line a, b, c
is one item until you press "Split on commas", which turns it into the three items
a, b and c. The line Smith, John is never
split unless you press that button.
Uses for a random order
- Shuffle the class list on the projector to set the presentation order, so nobody can say the order was chosen for or against them.
- For random seating, shuffle the names and read them off seat by seat.
- For a raffle with several winners, pick N at random for N prizes. Each name can win at most once.
- To randomise a quiz, paste the questions, shuffle, and number the result for a fresh paper each time.
- To check a sample, pick 20 of 400 invoices, records or exercise books, so every one has the same chance of being inspected.
Frequently asked questions
Can the same order come up twice?
Yes. Each shuffle is independent and has no memory. With 4 items a repeat is quite likely (1 in 24); with 10 items it is very rare.
How is this different from the Random Group Generator and the Random Name Picker?
The Random Group Generator splits names into even groups, and the Random Name Picker draws one name at a time. This tool returns the whole list in a new order or a sample of N items.
Sources
- Durstenfeld R (1964). Algorithm 235: Random permutation. Communications of the ACM 7(7): 420. The in-place, last-to-first form of the Fisher–Yates shuffle described above.
- Bayer D, Diaconis P (1992). Trailing the dovetail shuffle to its lair. The Annals of Applied Probability 2(2): 294–313. Shows that about (3/2)·log2 n riffle shuffles are needed for n cards, and that for a 52-card deck seven shuffles bring it close to random.
- W3C (2017). Web
Cryptography API. W3C Recommendation, section 10.1.
getRandomValuesasks for a cryptographic generator seeded with high-quality entropy, for example from the operating system.