Randomness and Dice II.

A little while ago I posted a message on GQ about my method for generating random numbers for the lottery. As I said, I used two dice to get the numbers 0 thru 9. It was explained though that this method was not entirely random.

Well, I have since come up with another system (BTW, I also have since gotten 10-sided dice–so this question is mostly scientific in nature):

Instead of two dice, I only take one die, and roll it. If it come up 1 thru 5, that is the number I take, i.e., 1 thru 5. But if it comes up 6, I roll the die again. And whatever number I then get, I add 5 to that. 10, of course, counts as zero.

So far I see no flaw in my system. It seems the numbers it generates should be truly random. But still I have this nagging doubt their must be some flaw in it. Does anyone know if this system generates numbers that are truly random?

:slight_smile:

Not even close. When you roll the die the first time, the odds of rolling a given number is 1/6. So, 1/6 of the time, you will roll a 6 and have to roll again to get your numbers from 7-10. So, numbers from 7-10 will occur 1/6 as often as the lower numbers. A quick and dirty program with 10,000 trials proves this:

1 - 1647
2 - 1689
3 - 1687
4 - 1680
5 - 1665
6 - 261
7 - 293
8 - 285
9 - 266
0 - 263

It certainly generates random numbers, the question you really want to ask is whether or not it generates uniformly random numbers–is each number equally as likely as any other number?

And the answer is no, it doesn’t. It should be easy to see that the probability of 1 through 5 is 1/6 each.

I’m assuming that if you keep rolling 6’s, you keep going until you get a non-6, then add 5 to that. In that case, 6 through 10 are all equally likely, but there’s only a 1/6 chance of getting 6 through 10 in the first place (since there’s a 5/6 chance of getting 1 through 5, as mentioned above). So, while 1 through 5 get a 1/6 chance each, 6 through 10 only get a 1/30 chance each.

In this case, the most efficient means of doing it right goes like this:

Roll until you get something other than a 6. That’s your total. Roll one more time, and if it’s even, add 5 to your total. If you get a 10, change it to 0.

This method takes, on average, 2.2 rolls, which is the theoretical best you can do.

A long long time ago, I asked a similar question in this forum. The general solution which will work for any two numbers (besides 6 and 10) is not too complicated, but what I gave above is a simplified version on that.

Oops, I slightly misunderstood. Reprogramming to reroll until other than a 6 is rolled gets:

1 - 1736
2 - 1673
3 - 1675
4 - 1676
5 - 1650
6 - 342
7 - 283
8 - 302
9 - 336
0 - 327

This pretty well meshes with Cabbage’s analysis, since 1/30 of 10,000 is 333.3…

I you want to generate uniform random numbers (1 to 10) with a six-sided die, you’d have to do something like this: Get two dice (or roll one twice, deciding before you start which roll is which). On your first die, call odd numbers 0 and even numbers 5. If your second die, if you get a 6, discard the roll. Otherwise add it to the 0 or 5 from the first die. Of the 36 possibilities, you’re now discarding 6, and 3 each give you each number from 1 to 10.

A similar question’s answer

That thread gets pretty math-intensive after that point, so proceed with caution.

why not roll with a d10, if it’s 10, re-roll, and 1-9 count as themselves?

Nah, 10 counts as 0.