# Randomness and Dice II.

**URL:** <https://boards.straightdope.com/t/randomness-and-dice-ii/195067>\
**Category:** Factual Questions\
**Created:** [August 14, 2003, 3:06am UTC](https://boards.straightdope.com/t/randomness-and-dice-ii/195067 "2003-08-14T03:06:20Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jim\_B](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/jim_b/32/4338_2.png) [@Jim\_B](https://boards.straightdope.com/u/Jim_B)\
**Post date:** [August 14, 2003, 3:06am UTC](https://boards.straightdope.com/t/randomness-and-dice-ii/195067/1 "2003-08-14T03:06:20Z")

</div>

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?

🙂

---

<div class="post-metadata">

**Author:** ![Q.E.D](https://avatars.discourse-cdn.com/v4/letter/q/51bf81/32.png) [@Q.E.D](https://boards.straightdope.com/u/Q.E.D)\
**Post date:** [August 14, 2003, 3:26am UTC](https://boards.straightdope.com/t/randomness-and-dice-ii/195067/2 "2003-08-14T03:26:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Cabbage](https://avatars.discourse-cdn.com/v4/letter/c/f07891/32.png) [@Cabbage](https://boards.straightdope.com/u/Cabbage)\
**Post date:** [August 14, 2003, 3:29am UTC](https://boards.straightdope.com/t/randomness-and-dice-ii/195067/3 "2003-08-14T03:29:46Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Achernar](https://avatars.discourse-cdn.com/v4/letter/a/e274bd/32.png) [@Achernar](https://boards.straightdope.com/u/Achernar)\
**Post date:** [August 14, 2003, 3:55am UTC](https://boards.straightdope.com/t/randomness-and-dice-ii/195067/4 "2003-08-14T03:55:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Q.E.D](https://avatars.discourse-cdn.com/v4/letter/q/51bf81/32.png) [@Q.E.D](https://boards.straightdope.com/u/Q.E.D)\
**Post date:** [August 14, 2003, 3:56am UTC](https://boards.straightdope.com/t/randomness-and-dice-ii/195067/5 "2003-08-14T03:56:13Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![viking](https://avatars.discourse-cdn.com/v4/letter/v/bc79bd/32.png) [@viking](https://boards.straightdope.com/u/viking)\
**Post date:** [August 14, 2003, 4:02am UTC](https://boards.straightdope.com/t/randomness-and-dice-ii/195067/6 "2003-08-14T04:02:28Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Achernar](https://avatars.discourse-cdn.com/v4/letter/a/e274bd/32.png) [@Achernar](https://boards.straightdope.com/u/Achernar)\
**Post date:** [August 14, 2003, 4:06am UTC](https://boards.straightdope.com/t/randomness-and-dice-ii/195067/7 "2003-08-14T04:06:45Z")

</div>

[A similar question’s answer](http://boards.straightdope.com/sdmb/showthread.php?s=&postid=476114#post476114)…

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

---

<div class="post-metadata">

**Author:** ![chaoticbear](https://avatars.discourse-cdn.com/v4/letter/c/f07891/32.png) [@chaoticbear](https://boards.straightdope.com/u/chaoticbear)\
**Post date:** [August 14, 2003, 12:24pm UTC](https://boards.straightdope.com/t/randomness-and-dice-ii/195067/8 "2003-08-14T12:24:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ultrafilter](https://avatars.discourse-cdn.com/v4/letter/u/3d9bf3/32.png) [@ultrafilter](https://boards.straightdope.com/u/ultrafilter)\
**Post date:** [August 14, 2003, 2:40pm UTC](https://boards.straightdope.com/t/randomness-and-dice-ii/195067/9 "2003-08-14T14:40:09Z")

</div>

Nah, 10 counts as 0.
