DevKits

List Shuffler — Randomize Line Order Online

Shuffle any list of lines into random order using Fisher-Yates. Optional trimming and blank-line filtering. Great for bucketing users into A/B tests, randomizing a playlist, or breaking alphabetical bias. 100% local.

Last updated:

79 chars · 8 lines

Paste a list and get it back in random order. Uses Fisher-Yates for a uniform, unbiased shuffle. Optional whitespace trimming and blank-line filtering.

What is List Shuffler?

List shuffling is the elementary operation of putting things in random order. Its correctness is deceptively subtle — the widely-copied `arr.sort(() => Math.random() - 0.5)` produces a biased permutation because JavaScript's sort algorithm assumes a consistent comparator. The correct algorithm is Fisher-Yates (also called Knuth shuffle): iterate from the end, and swap each element with a random one from itself to the current position. This tool implements Fisher-Yates directly, so every possible ordering of your list is equally likely.

How to shuffle a list online

  1. 1Paste your list, one item per line.
  2. 2Toggle 'trim whitespace' and 'ignore empty lines' if needed.
  3. 3Click Shuffle — the output is a uniform random permutation.
  4. 4Click again for a fresh shuffle — each click uses a new random seed.

Use Cases

Randomize a playlist

Paste song titles, click shuffle, get a fair new order without your music app's questionable shuffle algorithm.

Break alphabetical bias in surveys

Shuffling answer choices in a survey removes primacy bias — respondents no longer favor the first item.

Randomize test-question order

For an exam bank, shuffle questions so cheating from a neighbor doesn't work.

Tips & Best Practices

  • Never use `arr.sort(() => Math.random() - 0.5)`. It's biased in every major JS engine — some elements are more likely to stay near their starting position.
  • Fisher-Yates is O(n) — it can shuffle millions of items in a fraction of a second.
  • For repeatable shuffles (unit tests), do it in code with a seeded PRNG. This tool always uses fresh Math.random.

Frequently Asked Questions

How does the shuffle work?

It uses Fisher-Yates (also known as Knuth) shuffle, which produces a uniform random permutation in O(n) time. Every possible ordering of your list is equally likely.

How is this different from Random Picker?

Random Picker returns a subset of size N; List Shuffler returns the full list in random order. Use Shuffler when you want to reorder without dropping anything.

Is the shuffle repeatable?

No — every click gets a fresh random ordering based on Math.random. If you need a repeatable / seeded shuffle (for testing), do it in code with a seeded PRNG like mulberry32.

Is my list uploaded anywhere?

No. All shuffling runs in your browser.

Related Tools