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?
| Lines | Possible orders |
|---|---|
| 5 | 120 |
| 10 | 3,628,800 |
| 20 | about 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.