Overview
Introduction
Randomizing the order of lines by hand, for a shuffled list, a quiz question order, or randomized test data, is tedious and easy to get visibly non-random.
This tool shuffles line order for you using a proper Fisher-Yates shuffle, and it runs entirely client-side, so nothing you paste is ever uploaded to a server.
What Is Line Order Randomizer?
A line shuffler that randomizes the order of the lines in your text while leaving the text of each line untouched.
It runs entirely client-side as part of this site's String Tools collection, so nothing you paste is ever uploaded to a server.
How Line Order Randomizer Works
The text is split on newline characters into an array of lines, that array is shuffled with a Fisher-Yates algorithm, and the shuffled lines are rejoined with newlines.
The transformation happens synchronously in JavaScript, using the browser's own random number generator, with no network round trip involved.
When To Use Line Order Randomizer
Use it to randomize the order of a list, quiz answer choices, a set of test fixtures, or any line-delimited data where order shouldn't matter.
It's a fast way to get an unbiased shuffle without opening a code editor, a REPL, or writing a one-off script just to check.
Often used alongside Text Sorter, Sentence Order Randomizer and Paragraph Order Randomizer.
Features
Advantages
- Uses a proper Fisher-Yates shuffle instead of a naive sort-by-random-key approach, avoiding bias.
- Never touches the text within a line, only its position.
- Uses a real Fisher-Yates pass rather than sorting with a random comparator, so every ordering is equally likely instead of being skewed towards the original.
Limitations
- Randomness is not cryptographically secure and isn't seeded, so a shuffle can't be reproduced later.
- Shuffles whole lines only, so a trailing blank line becomes an empty entry that can end up anywhere in the result.
Examples
Best Practices & Notes
Best Practices
- Use a 'Shuffle again' click if the first shuffle happens to look too close to the original order.
- Strip trailing blank lines first, otherwise an empty line can be shuffled into the middle of the list.
- Save the output as soon as it looks right, since the arrangement cannot be recovered once you shuffle again.
Developer Notes
The shuffle is implemented as a standard Fisher-Yates: iterate from the last index down to 1, and at each step swap the current element with one at a uniformly random index from 0 to the current index inclusive, using `Math.random()`.
Line Order Randomizer Use Cases
- Randomizing quiz or survey answer order
- Shuffling a list of names for a drawing
- Randomizing the order of test fixtures or sample data
Common Mistakes
- Expecting the shuffle to be reproducible between runs; it uses `Math.random()` and is not seeded.
- Shuffling a list whose lines depend on one another, such as a header row or paired entries, which the shuffle separates.
Tips
- Combine with the Sentence or Paragraph Randomizer if you need to shuffle at a different granularity than whole lines.
- A list of n lines has n factorial possible orderings, so re-running on anything longer than a handful of lines will effectively never repeat itself.