By · Updated

Random Team Generator

Split a List of Names Into Fair Groups

No ratings yet

OneTask is free, with no sign-up, and built by one person.
If this tool saved you time, a coffee helps keep new ones coming.

How the Random Team Generator works

This random team generator splits any list of names fairly. Paste names one per line (or comma-separated), choose either how many teams you want or how many people should be in each, and the list is shuffled and dealt out. Sizes are kept as even as the arithmetic allows, and the shuffle uses the browser's cryptographic random generator so the result is genuinely random rather than merely random-looking. change the Reshuffle number for a fresh deal; the list never leaves your browser.

How the random team generator works

Splitting a group into teams sounds trivial and is surprisingly easy to get subtly wrong. There are two things to get right: the shuffle has to be fair, meaning every possible arrangement is equally likely, and the dealing has to be even, meaning no team ends up two people short because of how the numbers divided. This page does both, and the details matter enough to explain.

A fair shuffle. The correct algorithm is the Fisher–Yates shuffle: walk from the end of the list to the start, and at each position swap the current item with a randomly chosen item from the unshuffled portion including itself. Done that way, every one of the n! orderings has exactly the same probability. The common shortcut of sorting the list with a random comparison function does not do this; it produces some orderings far more often than others, and the bias depends on the browser's sort implementation. Team generators built that way tend to leave the first few names clustered together more than chance would predict, which is exactly the thing people complain about when they suspect a draw was fixed.

Where the randomness comes from. Each swap needs a random index, and there are two places to get one. Math.random() is a pseudo-random sequence from a seed, statistically fine but predictable in principle if someone can observe enough of its output. crypto.getRandomValues() draws from the operating system's cryptographic generator, seeded continuously from hardware noise and designed so that previous outputs reveal nothing about the next. This page uses the cryptographic source and converts its 32-bit output to an index with rejection sampling, discarding the small top range of values that would otherwise make low indices very slightly more likely. For a pub quiz the difference is academic; for anything where team assignment carries a prize or a burden, it means nobody can reasonably argue the draw was predictable.

Dealing evenly. Once shuffled, names are dealt round the teams like cards: first name to team 1, second to team 2, and round again. Ten people into three teams gives 4, 3, 3 rather than 4, 4, 2. When you ask for a number of people per team instead, the number of teams is the ceiling of people divided by size, so 11 people at 4 per team gives three teams of 4, 4, 3. The stats beneath the result show the team size range so an uneven split is obvious at a glance.

Input handling. Names are split on new lines or commas, trimmed, and blank entries dropped. Duplicates are kept, because two people really can share a name; if the list came from somewhere messy, run it through the duplicate remover first. Anything from two names up works, and asking for more teams than people simply gives you one person per team.

Reshuffling. Every change reshuffles from scratch, so if the first draw puts the two people who cannot be in the same room together, change the Reshuffle number for a fresh deal. That is a legitimate use; what it is not is a way to get a "better" random result, because there is no such thing. A fair shuffle will regularly produce teams that look lopsided by skill or friendship, and that is what random means.

FAQ

How does it decide who goes where?

The list is shuffled with the Fisher–Yates algorithm using the browser's cryptographic random generator, then dealt round the teams in turn. Every possible arrangement is equally likely and team sizes never differ by more than one person.

Can I make the teams balanced by skill?

No. This is a random draw and deliberately knows nothing about the people on the list. For a skill-balanced split, sort the list by ability first and deal it out by hand in a snake pattern, or use the generator once per skill tier and merge the results.

What if the numbers do not divide evenly?

The extra people are spread one per team from the first team onwards, so ten people into three teams gives sizes of 4, 3 and 3. The stats show the size range so you can see when a split is uneven before you announce it.

Why did it put the same people together again?

Because that happens with genuine randomness more often than intuition expects. With eight people in two teams there are only 35 distinct splits, so repeats are common. Change the Reshuffle number to deal a different split.

See also: all Lists & Lines tools, Writing & Editing, Markdown & HTML, Ciphers & Alphabets.

Related tools