EthicalFusion

Shuffle Lines

Randomly shuffle the order of lines in a list.

Was this tool helpful?

Thanks for the feedback!

Shuffle Lines puts the lines of your list into a random order. Paste names, questions, songs or tasks one per line, press Shuffle, and every press produces a fresh arrangement, so you can reshuffle until you are happy or take the first result as the fair draw.

How the shuffle works

The tool uses the Fisher-Yates shuffle, the standard algorithm for randomising a list. It walks from the last line to the first and swaps each line with a randomly chosen line at or before its position. With a fair random source, every possible ordering is equally likely, which shortcuts such as sorting with a random comparison function do not guarantee.

The randomness comes from the browser's built-in Math.random(). That is fine for classrooms, games and everyday decisions, but it is not a cryptographic generator, so do not rely on it for draws where prizes or money are at stake and the result may be audited.

How many orders are possible?

LinesPossible orders
5120
103,628,800
20about 2.4 quintillion

The number of orders is the factorial of the line count. It also means a shuffle can occasionally return your original order, or leave some lines in place: with 5 lines there is a 1 in 120 chance of getting the exact input back.

Things the shuffle keeps and changes

  • Each line stays intact. Words within a line are never moved.
  • Blank lines are shuffled too. An empty line in your input will land somewhere random in the output. Remove empty lines first if you do not want gaps.
  • Duplicates stay. If a name appears twice, it will appear twice in the shuffled list.
  • A trailing line break counts as a line, so it may show up as an empty line in the middle of the result.

Everyday uses for a random order

  • Presentation or viva order: paste the class list and read the shuffled result aloud, so nobody can say the order was chosen.
  • Quiz and exam variants: shuffle the question list to make two or three versions of the same test.
  • Splitting into teams: shuffle the names, then take the first half as one team and the rest as the other, or count off in groups of four.
  • Revision: shuffle flashcard prompts or vocabulary so you are not memorising the order instead of the content.
  • Playlists and to-do lists: break the habit of always starting with the same song or task.

If you only need one winner rather than a full order, the Random Picker chooses a single line. To put a list back into a predictable order after shuffling, use the A to Z sorter.

Frequently asked questions

Is the shuffle truly random?
It uses the Fisher-Yates algorithm with the browser's Math.random, which is fine for games, classrooms and everyday choices. It is not a cryptographic generator, so avoid it for audited prize draws.
Why did a blank line appear in the middle of my list?
Empty lines, including one created by a trailing line break, are shuffled like any other line. Remove blank lines before shuffling to avoid this.
Can the shuffled list come out in the same order as before?
Yes, occasionally. Every order is possible, including the original one, although the chance drops quickly as the list gets longer.
Does it remove duplicate names?
No. Every line you enter appears in the result, including repeats.
How do I split a class into random groups?
Shuffle the list of names, then count off the result in groups of the size you need.

Related tools

Embed this tool on your site

Paste it into any blog or website. Free, with a credit link.