📝 Text

List Randomizer

Paste a list (one item per line), then shuffle the whole list or pick N random items, powered by cryptographically strong randomness.

Presets:
0
Total Items
0
Unique Items
0
Output Count

About the List Randomizer

Quick Answer: The List Randomizer shuffles any list of items, names, or numbers into an unbiased, randomized order using the Fisher-Yates shuffle algorithm. Perfect for raffles, contest giveaways, team picking, and draft ordering.

Shuffling relies on crypto.getRandomValues rather than Math.random(), executed via a mathematically proven Fisher-Yates algorithm. Every possible ordering has identical mathematical probability, avoiding the subtle skews present in naive comparator sorts. This guarantees fair outcomes for giveaways, contest drawings, classroom seating, and team drafting.

The mathematical foundation of the Fisher-Yates (Knuth) shuffle

The Fisher-Yates algorithm was initially designed by Ronald Fisher and Frank Yates in 1938 as a pencil-and-paper method for randomizing experimental data. In 1964, Richard Durstenfeld and later Donald Knuth transformed it into the optimal computer algorithm used today:

  1. Given an array of n elements, initialize a pointer at the final index: i = n - 1.
  2. Generate a cryptographically uniform random integer j such that 0 <= j <= i.
  3. Swap the element at position i with the element at position j.
  4. Decrement i by 1 and repeat until i = 1.

The mathematical proof of uniformity relies on induction. At each iteration i, every remaining element has exactly a 1 / (i + 1) probability of being selected. Across all n steps, the overall probability of generating any specific permutation of the list is exactly:

P(permutation) = (1 / n) * (1 / (n - 1)) * ... * (1 / 2) * 1 = 1 / n!

Because every one of the n! distinct permutations possesses the exact same probability, the algorithm is mathematically proven to produce zero structural bias.

Cryptographic randomness vs pseudo-random generators

Most common online randomizers rely on JavaScript's standard Math.random() method. While suitable for simple visual animations, standard Math.random() uses pseudo-random number generators (PRNGs) such as xoshiro128+ or XorShift. These algorithms maintain an internal numerical state that updates deterministically. If an observer captures a small sequence of outputs, the seed state can be mathematically reverse-engineered to predict all subsequent selections.

This List Randomizer employs the modern Web Cryptography API (crypto.getRandomValues()). This interface interfaces directly with the host operating system's cryptographic random pool (such as Windows CNG/BCryptGenRandom or Linux /dev/urandom), which harvests hardware entropy from thermal noise, CPU timing fluctuations, and device interrupts. This makes outcomes non-deterministic, cryptographically unpredictable, and legally defensible for official drawings.

Eliminating modulo bias through rejection sampling

A common programming error when generating bounded random integers is taking a 32-bit random integer modulo the desired range: integer % range. Because the 32-bit unsigned integer maximum (4,294,967,295) is rarely divisible by the range without a remainder, the remaining numbers wrap around to favor lower indices. For example, if a range is 3, the numbers 0 and 1 receive slightly more probability than 2.

This tool completely eliminates modulo bias using rejection sampling. We compute the highest multiple of the range that fits inside the 32-bit space:

limit = floor((2^32) / range) * range

Any random value generated equal to or greater than this limit is discarded, and a new 32-bit word is sampled. Because the accepted range is an exact multiple of the item count, every possible index has an identical mathematical probability down to the last decimal.

Permutation combinatorics: How many unique orders exist?

The total number of possible arrangements of an n-item list grows factorially. As shown in the table below, even moderately sized lists generate numbers of unique combinations that exceed human comprehension:

List Size (N) Permutations Formula (N!) Total Unique Arrangements Real-World Analytical Context
3 items3!6Small team presentation order
5 items5!120Meeting agenda topic sequence
8 items8!40,320Tournament quarter-final bracket seeds
10 items10!3,628,800Classroom group assignment rosters
12 items12!479,001,600Fantasy sports league draft picking order
16 items16!20,922,789,888,000Round-of-16 esports championship matchups
20 items20!2.433 * 10^18Exceeds total grains of sand on many beaches
52 items52!8.066 * 10^67Standard deck of playing cards (more than atoms in galaxy)

Applications across industries, education, and research

Unbiased list shuffling is an indispensable utility across a diverse spectrum of professional domains:

Why array.sort(() => Math.random() - 0.5) is broken

A widespread coding shortcut seen on beginner tutorials is sorting an array with a random comparator: list.sort(() => Math.random() - 0.5). This technique is fundamentally flawed. Modern JavaScript engines use sorting algorithms like Timsort (V8) or quicksort variants that expect a consistent, transitive comparison function. Violating the transitivity axiom causes items to get trapped in local comparison clusters, leading to severely biased distributions where certain items are up to 40% more likely to remain near their starting positions.

Comparison: Shuffling and randomization algorithms

Method Time Complexity Statistical Uniformity Cryptographic Security Recommended Use
Fisher-Yates + CSPRNG (This Tool) O(N) 100% Mathematically Uniform Yes (OS hardware entropy) Audits, giveaways, drafts, research
Fisher-Yates + Math.random() O(N) Uniform within PRNG limits No (predictable PRNG seed) Casual games, visual UI effects
Array Sort Comparator Bug O(N log N) Severely Biased & Skewed No Never (anti-pattern)
Knuth Reservoir Sampling O(N) Uniform for unknown streams Depends on PRNG source Infinite streaming data pipelines

Frequently Asked Questions

Why does this tool use crypto.getRandomValues() instead of Math.random()?

Math.random() is a general-purpose pseudo-random generator whose output can, in principle, be predicted if the underlying engine state is known. crypto.getRandomValues() draws from the operating system cryptographically secure random source instead, the same category of randomness used for generating encryption keys, which is a stronger guarantee for lottery draws or team assignments.

What is modulo bias, and how does this tool avoid it?

Taking a random 32-bit number modulo a range that does not divide evenly into 2^32 makes lower outcomes slightly more likely. This tool avoids modulo bias by calculating the largest multiple of the range that fits inside 32 bits and discarding any random integer falling above that threshold via rejection sampling before taking the modulo.

Is this the same as using array.sort() with a random comparator?

No. Sorting with Math.random() minus 0.5 is a flawed approach that produces biased, non-uniform orderings depending on the browser sorting algorithm. This tool executes an exact Fisher-Yates shuffle where all permutations possess identical mathematical probability.

What happens to blank lines in my pasted list?

Blank lines are excluded before shuffling. Each entry is trimmed, and empty rows are filtered out so that trailing or intermediate whitespace does not appear as empty items in your randomized output.

Can Pick N Random Items select the same item twice?

No. The picker performs a full Fisher-Yates shuffle of the entire list and extracts the first N items, ensuring sampling without replacement and preventing duplicate selections.

Are my list items uploaded or transmitted to any server?

No. All list parsing, rejection sampling, Fisher-Yates permutations, and item slicing run 100% locally in your web browser with complete client-side confidentiality.

How many unique permutations exist for a list of items?

A list containing n unique items has exactly n! (n factorial) possible permutations. For example, a list of 10 names has 3,628,800 possible unique arrangements, while a standard 52-card deck has over 8.0658 times 10 to the 67th power permutations.

Can I add sequential numbers to the randomized output?

Yes. Checking the Numbered output option automatically prefixes each shuffled row with sequential indices like 1., 2., 3., which is convenient for drafting orders, prize tiers, or tournament brackets.

How does the tool handle lists with duplicate items?

By default, every line in the input is treated as a distinct item even if names match. Enabling the Remove duplicates option filters out identical items before shuffling so only unique values are randomized.

Is there a maximum list size limit for shuffling?

The tool efficiently shuffles tens of thousands of items in a fraction of a second due to the linear O(N) time complexity of the Fisher-Yates algorithm. Standard browser memory easily handles lists containing over 50,000 lines.