Six people are on the agenda for Friday's meeting, and none of them wants to present first. Whoever sets the order will be accused of favouritism, so the host pastes the names into a shuffler and reads out the result. Three things decide whether that result is fair: how the shuffle works, what is in the pasted list, and the rule used to read the result.

What fair means for a list of names

A random order is fair when every possible order is equally likely. A list of n distinct names can be arranged in n! (n factorial) ways. Three names give 6 orders, 5 names give 120, and 8 names give 40,320. A fair shuffle picks one of those orders with equal probability. Mathematicians call this a uniform random permutation.

Because every order is equally likely, every person is equally likely to land in any given position, and the first k lines of the result are a fair random group of k people. So "shuffle, then read from the top" works for a speaking order, for one or more winners and for choosing team captains.

The list randomizer is built to produce this kind of uniform order. The rest of this guide covers how to keep it fair, from the list you paste to the result you announce.

Why sorting by a random number is not the same thing

Home-made shuffles often look random and still are not fair. Two common versions are biased:

  • Swapping each item with an item at any random position in the whole list.
  • Sorting the list with a comparison that returns a random answer.

The first one fails on simple arithmetic. With 3 items, each of the 3 steps picks one of 3 positions. That gives 3 × 3 × 3 = 27 equally likely paths but only 6 possible orders. Because 27 paths cannot be shared out evenly among 6 orders, some orders must come up more often than others: three of them are reached by 5 paths and three by 4, so some orders turn up about 25% more often than others. Jeff Atwood shows this with measured results. You would need hundreds of runs to notice it by eye, so a few test clicks will not reveal it.

A random-comparator sort is biased too, and how much depends on the sorting algorithm the browser engine uses. Mike Bostock illustrates this, and the Fisher–Yates article on Wikipedia lists it among common implementation errors.

The list randomizer uses the Fisher–Yates method in Durstenfeld's form. It works from the last line up to the first. At each step it swaps the current line with a line chosen at random from the part that has not been shuffled yet, and that choice can be the current line itself. The random position comes straight from a number between 0 and 1, so there is no modulo step, which is a source of bias in some implementations. Each of the n! orders is reached by exactly one path, so all of them are equally likely as long as the random numbers are uniform.

The method goes back to a 1938 pencil-and-paper procedure by Fisher and Yates. Richard Durstenfeld published the in-place computer version in 1964 as Algorithm 235 in Communications of the ACM.

Clean the list before you shuffle it

The shuffle keeps every line exactly as it is. It does not trim, filter or remove duplicates, so a mistake in the list goes straight into the draw and makes it unfair.

  • A name pasted twice gets two chances. Remove repeats first with the duplicate remover. If extra entries are meant to count as extra chances, such as one entry per ticket bought, leave them in on purpose and say so in advance.
  • Blank lines count as items too. They are shuffled along with the names, so an empty line can end up in first place.
  • A newline after the last name adds one more empty item.
  • A header line such as "Name", copied from a spreadsheet, is shuffled like any other line. Delete it before you shuffle.
  • Names on one comma-separated line count as a single item. Put each name on its own line first with split text.

Here is how blank lines change the count (⏎ marks a press of Enter):

Typed:      Ana⏎Ben⏎⏎Cleo⏎Dev⏎
Lines seen: "Ana", "Ben", "", "Cleo", "Dev", ""
Items: 6

That is four people but six items. Remove empty lines strips the blanks. Windows line endings are converted to plain newlines before the split, so they do not create extra items.

The quickest check is the Items counter. It should equal the number of people in the draw.

Turning one shuffle into an order, a winner or teams

One shuffle can serve several purposes, as long as the rule for reading it is fixed before anyone sees the result.

  • Speaking order: read the result from top to bottom.
  • One winner or several: take the first line, or the first k lines.
  • Teams: deal the lines out in turn (team 1, 2, 3, 1, 2, 3…), or cut the list into equal blocks from the top. Both methods are fair if the rule is chosen in advance.

Then shuffle once and keep that result. Clicking Shuffle list again until a "nicer" order turns up makes the process unfair, even though the tool itself is not. Announce beforehand that the first result counts, and nobody can argue for a second one.

Sometimes the result comes out in the original order. This is not a bug. For n distinct names it happens with a probability of 1/n!, which is 1 in 6 for three names and 1 in 120 for five.

To post the order in a chat, take the Shuffled list and, if you want it on one line, combine it with join lines. The list randomizer page has two example lists you can shuffle to see how the result changes on every click.

When a browser shuffle is not enough

The shuffle gets its random numbers from JavaScript's Math.random. The ECMAScript specification only requires a value from 0 up to but not including 1, "chosen randomly or pseudo randomly with approximately uniform distribution", using an implementation-defined algorithm. MDN notes that Math.random does not provide cryptographically secure random numbers, and that the seed cannot be chosen or reset by the user.

This has two practical consequences. The same shuffle cannot be reproduced later, and the tool keeps no record of it, so there is no audit trail to show anyone afterwards.

For a classroom order, a meeting rota or a team split, none of this matters. The method is unbiased, and nobody has a reason or a way to dispute a casual order.

Draws for money, prizes or under legal rules are different, because participants may need to check the process. Common practice is to publish the cleaned list before the draw and to shuffle live in front of participants or on a recorded screen share. Where the rules require it, organisers use a draw method designed to be audited. Browsers also offer a cryptographically strong generator, crypto.getRandomValues, the same kind of source behind random UUIDs (see why random UUIDs do not collide). But a stronger random source alone does not create a record that others can check. This is general practice, not legal advice; regulated draws have their own requirements.

Privacy

The shuffle runs in your browser. Your list is not uploaded or stored, which matters when it holds students' or employees' names. The badge on the tool page says the same: "Runs locally in your browser".

FAQ

Why can't I get the same shuffled order again later?

Each click shuffles from scratch using Math.random, and a web page cannot seed it. If you need to keep a result, use Copy result or take a screenshot straight away.

Can I keep a header or a fixed first line in place?

Not inside the tool. It shuffles every line it receives. Remove the lines that must stay put, shuffle the rest, then paste the fixed lines back above the result.