📝 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.

About the List Randomizer

Shuffling relies on crypto.getRandomValues rather than Math.random(), run through a proper Fisher-Yates shuffle, so every possible ordering is equally likely instead of subtly skewed the way naive random-sort implementations tend to be. That makes it a solid pick for giveaway drawings, assigning teams, or picking random winners.

Rejection sampling removes modulo bias from the random numbers

Pulling a random integer from a fixed range usually means generating a 32-bit random value and taking it modulo the range, but that shortcut has a subtle flaw: unless the range happens to divide evenly into 2³² (4,294,967,296), the remaining leftover values wrap around and land on the low end of the range slightly more often, biasing the outcome. This tool's secureRandomInt() function avoids that by computing the largest multiple of the range that still fits inside the 32-bit space, then discarding — and re-rolling — any random value that falls above that cutoff before taking the modulo. That rejection step is what makes every item mathematically equally likely to land in any position, rather than "close enough."

crypto.getRandomValues() instead of Math.random()

Math.random() is a pseudo-random number generator meant for things like animations or sampling, and its output can, in principle, be predicted if you know enough about the internal state of the specific JavaScript engine running it. crypto.getRandomValues(), part of the Web Crypto API, instead pulls from the operating system's cryptographically secure random number source — the same category of randomness used to generate encryption keys. For picking a lottery winner, assigning random teams fairly, or any use case where someone might be motivated to guess or influence the outcome, that's a meaningfully stronger guarantee than a general-purpose PRNG.

Fisher-Yates avoids the "sort by random comparator" bug

A very common but statistically wrong way to shuffle an array in JavaScript is array.sort(() => Math.random() - 0.5), which relies on the sort algorithm's internal comparison pattern and produces orderings that are demonstrably not uniform — some permutations come up far more often than others, depending on the browser's sort implementation. This tool instead uses the Fisher-Yates algorithm: starting from the last item and working backward, each item is swapped with a randomly chosen item from the remaining unshuffled portion of the list, including itself. Every one of the n! possible orderings of an n-item list has exactly equal probability, which is the property a genuine shuffle needs and a comparator-based sort does not reliably have.

Blank lines are silently dropped, not treated as list items

Before shuffling or picking, the input is split on line breaks, each line is trimmed, and any line that comes out empty is filtered out entirely. So a pasted list with stray blank lines between entries, or trailing whitespace-only lines at the end, won't show up as a mystery empty item in your results — those lines simply don't count. This also means the item count used for "Pick N" reflects only genuine content lines, not the raw line count of whatever you pasted.

Picking N items is a true draw without replacement

Rather than picking N items one at a time (which risks the same item getting picked twice unless you build in extra duplicate-checking logic), the tool runs a full Fisher-Yates shuffle of the entire list first and then simply takes the first N entries of that shuffled result. This guarantees no duplicates by construction and means every possible N-item combination is exactly as likely as every other — the same rigor as the full shuffle, just truncated to the count you asked for. The N value itself is clamped between 1 and the total number of items, so typing 0, a negative number, or a number larger than your list can't produce an invalid or empty draw.

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's cryptographically secure random source instead, the same category of randomness used for generating encryption keys, which is a stronger guarantee for anything like a lottery draw or fair team assignment.

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

Taking a random 32-bit number modulo a range that doesn't divide evenly into 2³² makes some outcomes very slightly more likely than others. This tool avoids that by computing the largest multiple of the range that fits in 32 bits and discarding, then re-rolling, any random value that lands above that cutoff before taking the modulo, so every item ends up with exactly equal probability.

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

No, and that's intentional. array.sort(() => Math.random() - 0.5) is a common but statistically flawed shuffle that produces non-uniform orderings depending on the browser's sort algorithm. This tool uses a proper Fisher-Yates shuffle instead, where every possible ordering of the list is mathematically equally likely.

What happens to blank lines in my pasted list?

They're removed before shuffling. Each line is trimmed and any line that ends up empty is filtered out, so stray blank lines or trailing whitespace won't appear as items in your shuffled or picked results.

Can "Pick N Random Items" select the same item twice?

No. The picker runs a full shuffle of the entire list first and then takes the first N entries, which guarantees no duplicates and means every possible N-item combination is equally likely to appear.