
Shuffle lines
Shuffle lines. Runs entirely on your device, nothing is uploaded.
Shuffle lines puts every line of a pasted text into a random new order with a Fisher-Yates shuffle, leaving each line's own text untouched. Every run reshuffles from scratch with Math.random, so the same input gives a different order each time. A trailing newline in the input is preserved. There is no seed, so a shuffle here cannot be reproduced.
Questions
What shuffle algorithm does it use?
Fisher-Yates, which is an unbiased in-place shuffle: it walks the array from the end, at each step swapping the current line with one chosen at random from the lines not yet placed. The randomness comes from Math.random.
Can I get the same shuffle twice?
No. There is no seed option, so each run reshuffles independently and the same input text produces a different order essentially every time.
Does it change the content of any line?
No. Only the order of the lines changes; the text inside each line is copied through unchanged.
What happens to the trailing newline?
It is preserved: the tool notes whether the input text ends in a newline before shuffling and restores it afterward, so shuffling does not add or remove a final blank line.
Is this suitable for a fair randomized drawing?
Fisher-Yates itself is a correct, unbiased shuffle algorithm. Math.random is not a cryptographic source of randomness, so for anything where an adversary might benefit from predicting or influencing the order, a cryptographic shuffle is a better fit.
Compare
| Tool | Runs on the CLI | Live as you type |
|---|---|---|
| Shuffle lines | Yes | Yes |
| Number lines | Yes | Yes |
| Reverse lines | Yes | Yes |
| Sort lines by length | Yes | Yes |
| Unique lines with counts | Yes | Yes |
| Prefix or suffix lines | Yes | Yes |
| Extract lines | Yes | Yes |