piapia123
en

Shuffle Text

Text

Everything runs locally in your browser — nothing is uploaded

Input
Drop a file here to load its contents
Output

Shuffle the order of a block of text. Each of the three units keeps what it should: lines only changes which line comes first (the line count and their contents are untouched); characters rearranges each line internally (the line structure stays, and a line break is never treated as a character that can wander off); words reorders words only, leaving the gaps between them and the leading and trailing whitespace where they were. The shuffle is Fisher–Yates. The common “swap a few random pairs” approach produces a biased distribution — some orders show up noticeably more often than others, which is a real defect for name lists, draws and sampling. The backwards Fisher–Yates variant gives every permutation the same probability. It is not live. A live mode would recompute on every keystroke: you spot the order you want, and the next key replaces it before you can copy. So there is an explicit button.

Features

  • Three units: lines, characters and words
  • Fisher–Yates shuffle, so every permutation is equally likely rather than approximately so
  • Word mode keeps leading and trailing whitespace and the gaps between words
  • Character mode keeps the line structure; emoji and ZWJ sequences move as whole clusters
  • One click gives a new arrangement; nothing recomputes until you ask
  • Blank lines are ordinary lines and take part like any other
  • Everything runs locally in your browser; nothing is uploaded

How to use

  1. Paste the text you want to shuffle
  2. Pick a unit
  3. Click Shuffle again for a new arrangement, then Copy when you like what you see

FAQ

Sometimes the result looks unchanged. Is it broken?
No — a random shuffle is allowed to return the original order. With two lines that happens 50% of the time; with three lines, about 17%. Shuffle a few times and watch, or try a longer input: with ten lines it is very unlikely to repeat. There is deliberately no “always different from last time” patch, because forcing that would make the distribution uneven.
Why can’t it shuffle as I type?
Because a shuffle cannot be derived from the input. A live mode recomputes on every keystroke, so the order you just decided you liked is replaced before your mouse reaches the copy button. Hence an explicit button — the same reasoning as the UUID and password generators.
Is the shuffle fair?
Yes. It uses Fisher–Yates (the backwards variant), where every one of the n! permutations has probability 1/n!. The common “walk the array and swap each element with a random position” loop has a measurable bias, which does matter for draws, sampling and random grouping.

Related tools