## A χ2 Test of the Up Card Over 226,864 Hands

### April 25 2018

If the shuffle of your Euchre deck is truly random, then the likelihood of the up card being any rank that you might pick is 1/6. Why is that, you may ask? Well, there are 6 possible ranks: 9, 10, Jack, Queen, King, and Ace. There's no reason for one rank to appear as the up card with any more frequency than another. So, for example, the likelihood of seeing the Jack appear as the up card when you deal a hand is just 1 in 6.

If you want to check whether your shuffle is fair, then the distribution of ranks over the up card is one of the easier things that you can test. What you want to do is shuffle the cards many, many times. After each shuffle, you deal out the cards and count how many times a 9, 10, Jack, etc was dealt out as the up card. For example, after dealing 96 hands, you might have seen the up card was an Ace in 17 of those hands, while it was a Jack in 20 of them, and so on. Once you have these numbers, you may not be quite sure what to do with them. You might think you'd find each rank as the up card exactly 16 times (6 ranks times 16 is 96), but that's unrealistic. Since the cards are random, you wouldn't expect each rank to show up **exactly** 1/6 of the time. How do you decide whether the shuffle is random based on your statistics?

If you think about it, your up-card distribution is analogous to the roll of a 6-sided die. There's a Stack Exchange page which describes how to run a Chi-Square test to check for the fairness of an n-sided die. There's a bit of math on that page, and you can check it out or read the Wiki page on the same topic if you want more detail! The general idea is that you compute a formula called χ2 for each side of your die (e.g. 1, 2, 3, 4, 5, 6 for a 6-sided die), sum up all the χ2 values, and compare the total with the "upper-tail critical values of χ² distributions" in a handy table.

I did this for a total of 226,864 Euchre hands which were collected during a few weeks in April of 2018. The χ2 value came to approximately 5.5. We have 5 degrees of freedom because there are 6 possible ranks. According to the χ2 test, if the shuffle is fair, then χ2 will be less than 9.236 in 90% of all tests, and less than 20.515 in 99.9% of all tests. Since our χ2 value came in at 5.5, I believe with great confidence that the shuffle at World of Card Games, which uses an algorithm called Fisher-Yates is fair, random, and good enough!