What's happening?
The question
In Mexican Train, the first play of a round lets you lay as many dominoes as you can in one line on your own train, starting from the number on the engine double in the hub. Going out on that very first play means every domino in your hand fits into one unbroken line, and every double in it gets covered.
How the page finds out
It does what a very patient person would do: shuffle the set, deal one hand, check whether it could go out, and repeat. Your computer does this hundreds of thousands of times a second. The more hands it deals, the steadier the answer gets. Mathematicians call this a Monte Carlo simulation, after the casino.
How it checks a hand
Think of each number 0 to 12 as a town and each domino as a road between two towns. Going out means driving every road exactly once, starting from the engine's town. A Swiss mathematician named Euler worked out the rule for this in 1736: it works if all the roads connect, and every town has an even number of roads except, at most, the starting town and one other. Doubles are little loops that start and end in the same town.
So was it a royal flush?
Not even close. A royal flush is about 1 in 650,000. With six players and 12 dominoes each, going out on the first play comes out to roughly 1 in 600 for one player. That's about as rare as being dealt a full house. Since a full game has 13 rounds and everyone gets a first play every round, a group of six should see it now and then. It's still a great moment, and well worth bragging about.
Does the engine number matter?
No. In a double-12 set every number appears the same way, so the odds are the same whether the engine is 12|12 or 1|1. You can still change it to match the round you remember.
Where the randomness comes from
The millions of practice shuffles use your browser's fast random number maker. The hands you deal yourself with the button will be shuffled by this lab's quantum random number generator once it's online: a small USB stick from Crypta Labs that measures tiny particles of light. When it's connected, the dot at the bottom turns green.