Draw by fixed team count
- Input
- 9 pessoas, 4 times
- Expected output
- 1 time com 3 pessoas, 3 times com 2 pessoas cada
The remainder of 9 divided by 4 is 1, so only 1 team gets the extra member; the size difference between teams never exceeds 1.
random team and group maker
Splitting a group into teams looks trivial, but the algorithm behind it decides whether the draw is actually fair. This page explains the cryptographic Fisher-Yates shuffle the tool runs, the classic mistake people make when shuffling arrays in JavaScript, and how the leftover from an uneven split gets spread across teams.
The remainder of 9 divided by 4 is 1, so only 1 team gets the extra member; the size difference between teams never exceeds 1.
The tool computes 3 teams (rounding 9/4 up) before shuffling, so the actual size closes at 3 per team, below the requested value.
With Fisher-Yates, each of the 6 possible orders of 3 names has exactly a 1-in-6 chance; the sort trick breaks that equality because the comparator is not transitive.
Names are shuffled and distributed round-robin: the first goes to team 1, the second to team 2, and so on, looping back to team 1 at the end of each pass. This keeps all teams the same size, or differing by at most one person when the total isn't divisible.
Because a sorting algorithm expects a consistent comparator, and this function returns a different result on every call for the same pair. The engine then produces skewed permutations, some output orders end up far more likely than others, even though Math.random itself draws fairly underneath.
Yes, the Fisher-Yates shuffle draws every swap with crypto.getRandomValues, the browser cryptographic API, instead of Math.random. That does not change the fairness of the distribution itself, but it closes the door on anyone trying to predict or reproduce the draw from a weak seed.
Because "by size" mode uses the requested value only to calculate how many teams to create, rounding up. With 9 people and a target size of 4, the calculation lands on 3 teams, and round-robin spreads the 9 people evenly across those 3 teams, ending at 3 members per team.
Only when the total number of people is a multiple of the team count. When it is not, round-robin spreads the division remainder across the first drawn teams, and the size gap between the largest and smallest team never exceeds 1 member.
Add the names and click "Generate teams" to see the drawn teams here.