"Just shuffle the list" sounds like a solved problem, but a surprising number of common shuffling implementations are quietly biased — some orderings end up more likely than others, even though it looks random on the surface. Splitting a group fairly starts with getting the shuffle itself right.

A Truly Fair Shuffle

The standard algorithm for a genuinely unbiased shuffle is the Fisher-Yates shuffle. It works backward through the list: for each position, starting from the last, pick a random remaining element (from the start of the list up to and including the current position) and swap it into that position, then move one position earlier and repeat. Done correctly, every one of the n-factorial possible orderings of the list is exactly equally likely — not approximately, but exactly, which is a stronger guarantee than it might sound.

The Hidden Bias in a Naive Shuffle

A common but flawed shortcut is sorting the list using a comparator that returns a random result, like array.sort(() => Math.random() - 0.5). This looks random and often "seems" to work, but it isn't actually fair: sorting algorithms make their comparison decisions in a specific, algorithm-dependent pattern, not by comparing every possible pair equally. Feeding random results into that pattern produces orderings where some arrangements come up more often than others — the bias is subtle enough to pass a casual glance but real enough to matter for anything where fairness is the point, like assigning teams.

Tip: If you're implementing your own shuffle for anything where fairness matters — drawing raffle winners, assigning teams, randomizing a quiz's answer order — use Fisher-Yates specifically rather than a sort-based trick, even though the sort-based version often looks correct in casual testing.

Splitting Groups That Don't Divide Evenly

Once the list is shuffled, splitting it into a set number of even groups is straightforward when the total divides evenly — but it rarely does. The fair approach is to compute the base group size (total divided by group count, rounded down) and then distribute the leftover people one at a time across the earliest groups, so no group ends up more than one person larger than any other. Splitting 17 people into 4 groups this way produces sizes of 5, 4, 4, and 4 — never a lopsided 8-3-3-3 split just because the numbers didn't divide cleanly.

Cryptographic Randomness vs. Math.random()

JavaScript's built-in Math.random() is fine for most casual randomness, but it isn't designed to be unpredictable in a security sense — its internal algorithm is deterministic and, in principle, its outputs could be predicted by someone who knows enough about the implementation and prior outputs. For anything where the randomness needs a stronger guarantee, the browser's crypto.getRandomValues() API draws from a cryptographically secure random number generator instead — the same underlying source used to generate passwords and encryption keys — which is a meaningfully stronger source of unpredictability, even for something as low-stakes as picking teams.

Randomizing a Group Instantly

Paste in a list of names and split them into fair, evenly-sized groups using a proper cryptographically random shuffle with the free Team Randomizer.

FAQ

How are the groups actually randomized? The full list is shuffled using a cryptographically secure random number generator (the same kind used for passwords), then split into the number of groups you chose in order — this guarantees every possible ordering of the list is equally likely, rather than using a weaker or predictable shuffling method.

Why can sorting a list with a random comparator produce a biased shuffle? Sorting algorithms make comparison decisions based on the specific pairs they happen to compare, and different sorting algorithms compare different pairs in different orders — so feeding a sort function a random "coin flip" comparator doesn't make every final ordering equally likely. Certain orderings end up quietly more probable than others depending on the sort algorithm's internal comparison pattern, which is a well-known trap.

What happens if the number of people doesn't divide evenly into the groups? The extra people are distributed one at a time across the earliest groups, so group sizes never differ by more than one person — for example, splitting 10 people into 3 groups produces sizes of 4, 3, and 3, not one oversized and two undersized groups.

Is my list of names sent anywhere? No — the shuffling and grouping happen entirely in your browser using JavaScript, so the list you enter is never sent to a server.

Need fair teams right now? Try the free Team Randomizer — paste your names, pick a group count, done.