Random Group Generator
The random group generator splits a list of names into a set number of groups, or into groups of a set size, and every possible grouping is exactly as likely as every other.
4 random groups
- Group sizes 14 does not divide evenly into 4, so the first 2 groups get one extra person. Which people land there is as random as everything else.
- 4, 4, 3, 3
- Names read
- 14 names
- Method The whole list is shuffled, then the first 4 go to group 1, the next 4 to group 2, and so on.
- Fisher-Yates shuffle, then dealt in order
- Equally likely orders 14! = 14 x 13 x ... x 1, and each order comes up with probability exactly 1/14!.
- 87,178,291,200
- Different ways to form these groups Counting a grouping once regardless of the order inside each group or the order of same-sized groups.
- 1,051,050
| Group | Size | Members |
|---|---|---|
| Group 1 | 4 | Ella, Noah, Jack, Maya |
| Group 2 | 4 | Isla, Chloe, Grace, Finn |
| Group 3 | 3 | Ben, Dev, Hugo |
| Group 4 | 3 | Ava, Kai, Leah |
How the Random Group Generator works
A random group generator does two things: shuffles the list, then deals it out. Both are simple, and the first is easy to get subtly wrong.
The shuffle here is Fisher-Yates, also called the Knuth shuffle. Walk the list from the first position to the last. At each position, pick one of the names that has not been placed yet, uniformly (every remaining name equally likely), and swap it into that position. With 14 names, the first pick is one of 14, the second one of the remaining 13, and so on down to the last, which has no choice. Every particular order therefore comes up with probability 1/14 x 1/13 x ... x 1/1 = 1/14!, which is the definition of a fair shuffle: all 87,178,291,200 orders exactly equally likely.
Dealing is the easy part. After the shuffle the first names go to group 1, the next to group 2, and so on, with the sizes fixed in advance. Because the shuffle is uniform, every way of splitting the people into groups of those sizes is equally likely. Each grouping corresponds to exactly the same number of shuffled orders.
The sizes are where you have a choice. By number of groups, the sizes are as even as possible: 14 people in 4 groups is 4, 4, 3 and 3. By people per group, "Keep groups even" decides what happens to the remainder. With it on, there are as many groups as keep every group at or under the size you asked for, with sizes differing by at most one (14 people in groups of 4 is 4, 4, 3 and 3). Nobody is ever left in a group of one: 7 people in pairs is two pairs and a trio. With it off you get full groups and whatever is left over: groups of 4 from 14 is 4, 4, 4 and 2, and pairs from 7 leaves one person out, who is named.
Names are split on commas, semicolons and line breaks. A repeated name is kept and numbered, on the assumption that two people can share a name; delete the repeat if it was a typing error. There is no way to put one named person in each group or to balance by skill.
Random Group Generator FAQ
Is this random group generator actually fair?
Yes, in the precise sense: every possible grouping with the sizes shown is exactly equally likely. The list is shuffled with Fisher-Yates using unbiased draws from your browser's cryptographic generator, and then dealt in order.
What happens when the names do not divide evenly?
By number of groups, some groups get one extra person, and who gets them is random. By group size, keep groups even spreads the remainder so sizes differ by at most one; with it off you get full groups and a smaller last one.
Can I keep two people out of the same group?
No. Constraints like that change the odds, and this generator only promises a draw where every grouping is equally likely. If two people should not be together, draw again until they are apart. Each draw is independent of the last.
Are the names sent anywhere?
No. The shuffle runs in your browser and the list stays on your machine.
Why do I get different groups each time?
Because each draw is a fresh shuffle. There is no seed and no memory of the previous draw. If you need a result others can check later, keep a screenshot of it.