PubTrivia's team name generator shows six names and a button that says "Six more". It is about twenty lines of logic over a static list, which makes it the smallest thing on the site worth measuring properly, and the measurement says two different things: the picker is fair, and it will still feel broken.
The pool
category names ------------------------ ----- Puns on famous names 28 Honest self-assessment 24 Food and drink 20 Music and film 18 Straight wordplay 20 ------------------------ ----- total 110 distinct 110 110 names, 1,920 characters, no duplicates across categories, 7 to 32 characters each. Three names contain a non-ASCII character, and two of those are the only curly apostrophes anywhere in the site's text, which I found out the hard way in an earlier census of every codepoint the site serves.
The draw
The picker copies the pool, splices a random index out of it six times, and returns those six. That is a partial Fisher-Yates, which gives two guarantees worth separating:
- Within one press, no name can repeat. The splice removes it from the working copy.
- Between presses, nothing is remembered at all. Each press is an independent sample of 6 from 110.
Those two facts are the whole user experience. The first is why a draw never looks broken. The second is why it does.
The birthday problem, in team names
The chance that two consecutive presses share at least one name is
1 - C(104,6) / C(110,6) = 0.2916 Not a simulation, just the ratio of "six names chosen from the 104 you did not just see" to "six names chosen from all 110". Nearly 30 per cent. Running out from there, with 200,000 simulated sessions per row:
presses P(a name has repeated by now) ------- ---------------------------- 1 0.0000 2 0.2915 3 0.6505 4 0.8843 5 0.9742 6 0.9964 The mean number of presses before you see a name twice is 3.20. Somebody pressing the button five times, which is the normal way to use a page like this, has a 97 per cent chance of seeing a repeat, and no reason to believe the list is 110 long.
It gets sharper inside a category, because the pool shrinks and the draw size does not:
category names P(consecutive presses overlap) presses to see all of it ---------------------- ----- ------------------------------ ------------------------ Puns on famous names 28 0.8020 17.0 Honest self-assessment 24 0.8621 13.8 Food and drink 20 0.9225 10.8 Straight wordplay 20 0.9225 10.8 Music and film 18 0.9502 9.3 Pick "Music and film" and 95 per cent of presses show you something you have already seen. For the whole pool, the mean number of presses to see all 110 names is 95.1.
Twelve real presses
Simulation is easy to argue with, so I drove the live page: load it, then click "Six more" eleven times, scraping the six list items each time.
press overlap with previous new names distinct seen ----- --------------------- --------- ------------- 1 - 6 6 2 0 6 12 3 1 5 17 4 1 4 21 5 0 6 27 6 1 5 32 7 1 4 36 8 1 4 40 9 1 4 44 10 0 3 47 11 0 4 51 12 0 4 55 55 distinct names after 12 presses, against an expected 53.9. That part matches almost exactly.
The overlap column does not: 7 of the 11 consecutive pairs shared a name, where the expected count is 3.2. I simulated that specific shape 100,000 times and 7 or more happens 1.8 per cent of the time, so this is a one-in-55 run rather than evidence of a bias. I am reporting it because the honest version of a measurement includes the row that did not behave, and because it is a good illustration of why twelve presses is not a test of randomness.
Is the picker actually uniform?
For that you need volume, not a browser. 600,000 draws of six, so 3.6 million names:
expected per name 32,727 most drawn 33,179 ("Multiple Scoregasms") least drawn 32,379 ("Trivia Newton John") chi-square 87.9 on 109 degrees of freedom A chi-square of 87.9 with 109 degrees of freedom sits around p = 0.9: no detectable bias, which is what you expect from splice-based selection, where the classic off-by-one bias of naive shuffles cannot occur. The distribution is fine. The complaint users will have is not about the distribution.
The invariant nothing checks
The rendered list keys each item by the name itself:
names.map((name) => <li key={name}>{name}</li>) That is correct as long as the pool holds no duplicates, which it does today: I checked all 110 and found zero. It is also the kind of property that holds until somebody adds "Quizteama Aguilera" to a second category, at which point the "everything" pool can hand React two children with the same key.
There is no test. The two other tools with test files have 16 tests each, covering the poster layout and the profit arithmetic. The names module has none, so the three things this component quietly depends on are uncovered:
- The pool is distinct.
- The combined pool is the concatenation of the categories, so a new category cannot be forgotten.
- Every category holds more than the draw size of 6.
Three assertions, four lines of test, and they pin down the only thing that can actually break.
What I would change
The fix for the repeats is not more randomness, it is memory. Keep a shuffled queue of the whole pool, hand out six at a time, and reshuffle when it runs dry. Every name appears once before any name appears twice, the queue costs one array, and the user who presses eighteen times sees 108 different names instead of about 70.
While doing that, two cheap honesty improvements: say how many names the category holds next to its button, and let the category buttons stop redrawing on selection, since right now choosing a category immediately spends a draw you did not ask for.
If you want to test the 29 per cent yourself, the generator is here, all 110 names are also rendered as plain text further down that page for anyone with JavaScript off, and the guide next to it is the version for people who would rather read than press a button. No account, nothing uploaded, and the Network tab stays empty while you click.
![[Phân tích kỹ thuật] Anthropic ra mắt Code Mode cho Claude Code: Bước ngoặt xâu chuỗi Tool Call bằng JavaScript](https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuurfrhh192toa94intza.webp)