Is The Lottery Random?

In this series of blog posts, I have picked on Baseball win-loss records already. Looking for other sources of things that might or might not be random, I decided to look at lottery draws. Since I live in Canada, the obvious lottery to look at is the national Lotto 6/49.

A lotto 6/49 draw consists of drawing 6 numbered balls from a pool of 49 balls. So, each draw can be described as set of 6 unique numbers between 1 and 49. The October 6th draw was: {10, 20, 24, 32, 37, 47} or, if we include the 7th bonus ball (drawn from the same pool) {10, 20, 24, 32, 37, 47, 49}.

The main problem here is that lottery draws are sequences of combinations, and the tools we have looked at are all designed to analyze sequences of bits. Fortunately this is not an insurmountable problem and we will handle it in two steps:

convert combinations into a dice rolls

convert dice rolls into bit sequences

To accomplish step 1, we can use a tool called a combinatorial number system which is basically, a 1 to 1 conversion between k-combinations of n items and the numbers between 1 and nCk. So, we will convert the 7 numbers of a 649 pick into a single number between 1 and 85,900,584 (i.e. 1 roll of an 85,900,584 sided die) using the formula

For step 2, we would be in luck if 85,900,584 were a power of 2 since then we could just convert the numbers from the die rolls into base-2 numbers. We are not that lucky, however: 226< 85,900,584 < 227. Since it is not a power of 2, the bits from the binary representation of the rolls is not going to be uniformly random.

In order to get a uniform sequence, we can use a simple algorithm (callled Q2) in the nice paper "Turning Loaded Dice into Fair Coins" from Juels et al at RSA Labs. This is the algorithm that turns fair dice rolls into variable numbers of fair coin flips:

Now we can apply some randomness tests to these bits. Attached to this post is a list of the 2768 Lotto 6/49 draws up to the end of July 2010. Compose the two procedures above to create a sequence of bits from the data:

(**) WaldWolfowitz(L);
WaldWolfowitz: sequence contains 35036 zeros and 35380 onesWaldWolfowitz: sequence has 35331 runsWaldWolfowitz: expected number of runs is 35208WaldWolfowitz: the variance is 17602.91WaldWolfowitz: the statistic for this sequence is is 0.925867 true, 0.3545152098

Except for the 18x18 binary rank test, all tests suggest that the lottery draws are random. This shouldn't be particularly surprising, given the money involved a great deal of effort goes into assuring the soundness of the drawing process.

If we hadn't used the roll2bits procedure and instead had just used Bits:-Split to get 26 bits from each Lottery draw, the results actually look pretty similar, except for the results of SequenceFrequency which are clearly show the non-uniformity. As always, here is a worksheet with the computations: LottoRandomnessTest.mw. The code for the various randomness tests are in the start up code.