# I suck at probability

**URL:** <https://boards.straightdope.com/t/i-suck-at-probability/644529>\
**Category:** Factual Questions\
**Created:** [December 19, 2012, 3:33pm UTC](https://boards.straightdope.com/t/i-suck-at-probability/644529 "2012-12-19T15:33:42Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nature\_s\_Call](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/nature_s_call/32/19006_2.png) [@Nature\_s\_Call](https://boards.straightdope.com/u/Nature_s_Call)\
**Post date:** [December 19, 2012, 3:33pm UTC](https://boards.straightdope.com/t/i-suck-at-probability/644529/1 "2012-12-19T15:33:42Z")

</div>

I don’t know why I didn’t think to ask you earlier, but [supery00n’s question](http://boards.straightdope.com/sdmb/showthread.php?t=676036) reminded me there’s no place like the Dope for questions like this.

The details arise from a surprising experience a buddy experienced in one of his games of HeroClix\* but I’ll frame the details generically. It involves a bunch of dice rolls - each roll a single one sided-die.

I want to calculate the odds of 13 out of 15 “tests” passing.

A “test” is this: you get two chances to roll a 5-6. If roll 1 is 5-6, test over. If not, roll again. 5-6 on the second roll? pass. IOW: to fail a test, each of two rolls is 1-4.

Am I correct that each test has a 2/3 chance of passing (1/3 + 1/3)? Beyond that, my brain goes swimmy - 13/15 \* 2/3 - exponent something… arrgghhh.

What are the odds that out of 15 attempts, all but two pass? I intuit the odds are crazy unlikely. Would this result be enough to raise suspicion of loaded dice?

(I created a simple simulator in Excel and ran it 100 times. Got lots of 11s, couple of 12s, no 13s)

Side question: in the spirit of “teach a guy to fish” is it reasonable in the scope of this question to explain tutorial-wise how you arrived at the answer?

* * *

- Buddy was up against a dude with both Shape Change and Super Senses. He got off 15 attacks and dude dodged all but two.

---

<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:** [December 19, 2012, 3:45pm UTC](https://boards.straightdope.com/t/i-suck-at-probability/644529/2 "2012-12-19T15:45:44Z")

</div>

There’s a 2/3 \* 2/3 probability of failing any single test because the die rolls are [independent](http://en.wikipedia.org/wiki/Independence_(probability_theory)), so there’s a 5/9 chance of passing it. All of the tests are independent as well, so the number of passed tests follows a [binomial distribution](http://en.wikipedia.org/wiki/Binomial_distribution) with n = 15 and p = 5/9. Per Wolfram Alpha, the probability of passing 13 tests is [about 1%](http://www.wolframalpha.com/input/?i=%2815+choose+13%29+*+%285%2F9%29%5E13+*+%284%2F9%29%5E2).

---

<div class="post-metadata">

**Author:** ![hogarth](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/hogarth/32/1773_2.png) [@hogarth](https://boards.straightdope.com/u/hogarth)\
**Post date:** [December 19, 2012, 3:45pm UTC](https://boards.straightdope.com/t/i-suck-at-probability/644529/3 "2012-12-19T15:45:49Z")

</div>

The probability of rolling 1-4 twice in a row is (2/3)\*(2/3) = 4/9. So the probability of that not happening is 5/9.

The likelihood of failing exactly two times is less than 1%, but it’s not **that** unlikely.

EDIT: ninja’ed

---

<div class="post-metadata">

**Author:** ![babygoat666](https://avatars.discourse-cdn.com/v4/letter/b/2acd7d/32.png) [@babygoat666](https://boards.straightdope.com/u/babygoat666)\
**Post date:** [December 19, 2012, 3:46pm UTC](https://boards.straightdope.com/t/i-suck-at-probability/644529/4 "2012-12-19T15:46:05Z")

</div>

It’s easier to look at it from the other way since if you roll a 5 or 6 the first time you don’t need to roll again. Using this part here:

> [@](#):
>
> IOW: to fail a test, each of two rolls is 1-4.

Your chances rolling a 1-4 on each roll is 2/3, and to do that twice in a row you multiply the odds, so the odds of failure are 4/9 and odds of success are 5/9 for a single test. Check out probability trees, they are very helpful for visualizing this type of problem.

Do you want the odds of exactly 13 tests passing, or at least 13 tests passing?

---

<div class="post-metadata">

**Author:** ![babygoat666](https://avatars.discourse-cdn.com/v4/letter/b/2acd7d/32.png) [@babygoat666](https://boards.straightdope.com/u/babygoat666)\
**Post date:** [December 19, 2012, 3:47pm UTC](https://boards.straightdope.com/t/i-suck-at-probability/644529/5 "2012-12-19T15:47:39Z")

</div>

When you preview your post it would be nice if it would let you know not to bother posting it.

---

<div class="post-metadata">

**Author:** ![Saffer](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/saffer/32/6440_2.png) [@Saffer](https://boards.straightdope.com/u/Saffer)\
**Post date:** [December 19, 2012, 3:48pm UTC](https://boards.straightdope.com/t/i-suck-at-probability/644529/6 "2012-12-19T15:48:19Z")

</div>

Assuming you mean a 6 side die then the probability of rolling a 1 to 4 is 2/3. The probability of doing this twice in a row is (2/3)\*(2/3) = 4/9. This is the probability of failing the test. Therefore the probability of passing is 5/9.  
Now read about the binomial distribution on wikipedia

> **[Binomial distribution](https://en.wikipedia.org/wiki/Binomial_distribution)**
>
> In probability theory and statistics, the binomial distribution with parameters n and p is the discrete probability distribution of the number of successes in a sequence of n independent experiments, each asking a yes–no question, and each with its own Boolean-valued outcome: success (with probability p) or failure (with probability 
>   
>     
>       
> q
> =
> 1
> −
> p
>       
>     
> {\\displaystyle q=1-p}
>   
> ). A single success/failure experiment is also called a Ber...

you should try to work it out from here (learn to fish sort of thing), if you get stuck I will help.

---

<div class="post-metadata">

**Author:** ![Nature\_s\_Call](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/nature_s_call/32/19006_2.png) [@Nature\_s\_Call](https://boards.straightdope.com/u/Nature_s_Call)\
**Post date:** [December 19, 2012, 3:49pm UTC](https://boards.straightdope.com/t/i-suck-at-probability/644529/7 "2012-12-19T15:49:47Z")

</div>

Came back to report: ran another 100 through the simulator and one hit.

Also noticed I said “single one-sided die” when I meant, of course, to say single six-sided die (1d6)

(on preview) Thanks for replying, **babygoat666** : I want to know what are the odds of passing this test exactly 13 out of 15 times.

ETA: wow, lots of replys between previews! Thanks to all! Now reading “Binomial distribution”

---

<div class="post-metadata">

**Author:** ![ZenBeam](https://avatars.discourse-cdn.com/v4/letter/z/3ab097/32.png) [@ZenBeam](https://boards.straightdope.com/u/ZenBeam)\
**Post date:** [December 19, 2012, 11:29pm UTC](https://boards.straightdope.com/t/i-suck-at-probability/644529/8 "2012-12-19T23:29:40Z")

</div>

> [@Nature\_s\_Call](#):
>
> Came back to report: ran another 100 through the simulator and one hit.

How long does it take to run? If you can run it 10,000 times or more, you should be able to roughly verify the 1% figure.

---

<div class="post-metadata">

**Author:** ![hibernicus](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/hibernicus/32/2802_2.png) [@hibernicus](https://boards.straightdope.com/u/hibernicus)\
**Post date:** [December 20, 2012, 1:41pm UTC](https://boards.straightdope.com/t/i-suck-at-probability/644529/9 "2012-12-20T13:41:03Z")

</div>

> [@Nature\_s\_Call](#):
>
> Would this result be enough to raise suspicion of loaded dice?

Interestingly, this question can’t be answered unless you know the probability of a given pair of dice being loaded. This is counter-intuitive, because you probably carry in your mind some “common sense” idea of how prevalent loaded dice are. You may say “the chances of that outcome (with honest dice) are only 1%, so I’m thinking there’s a good chance the dice are loaded”. But think how that would change if you knew that out of the millions of dice in the world, only three were loaded.

---

<div class="post-metadata">

**Author:** ![Nature\_s\_Call](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/nature_s_call/32/19006_2.png) [@Nature\_s\_Call](https://boards.straightdope.com/u/Nature_s_Call)\
**Post date:** [December 20, 2012, 1:43pm UTC](https://boards.straightdope.com/t/i-suck-at-probability/644529/10 "2012-12-20T13:43:23Z")

</div>

The Excel simulator is too manual (have to hit F9 100 times and count on one’s fingers).

Here’s an improved simulator using Python:

```auto

from random import randint

attacksPerGame = 15
surprisingThreshold = 13

numGames = 0
numOccurences = 0

print "Hit Ctrl+C to quit"
try:
  while True:
    numGames += 1

    numDodged = 0
    for i in range(1, attacksPerGame + 1):
      isDodged = randint(1, 6) >= 5 # Shape Change
      
      if not isDodged:
        isDodged = randint(1, 6) >= 5 # Super Senses
        
      if isDodged:
        numDodged += 1
        
    if numDodged >= surprisingThreshold:
      numOccurences += 1
      
    print "{0} games, {1} occurrences ({2}%)\r".format(numGames, numOccurences, (float(numOccurences) / numGames) * 100.0),
    
except KeyboardInterrupt:
  print
  pass

```

I let this run for 1 million iterations (took just over a minute). I’ve tried it a number of times and it seems to settle into about 1.18% This is higher than the calculated value of 0.996%. This likely reveals a “flaw” in the pseudo-random generator, but it’s pretty close.

---

<div class="post-metadata">

**Author:** ![Sailboat](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/sailboat/32/461_2.png) [@Sailboat](https://boards.straightdope.com/u/Sailboat)\
**Post date:** [December 20, 2012, 1:49pm UTC](https://boards.straightdope.com/t/i-suck-at-probability/644529/11 "2012-12-20T13:49:13Z")

</div>

> [@Nature\_s\_Call](#):
>
> I let this run for 1 million iterations (took just over a minute). I’ve tried it a number of times and it seems to settle into about 1.18% This is higher than the calculated value of 0.996%. This likely reveals a “flaw” in the pseudo-random generator, but it’s pretty close.

I think it’s funny (and also a classic example of how testing turns up the unexpected) that your simulator, written in part to test if dice were loaded, reveals that the computer pseudo-random number generator is, itself, “loaded.”

---

<div class="post-metadata">

**Author:** ![Nature\_s\_Call](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/nature_s_call/32/19006_2.png) [@Nature\_s\_Call](https://boards.straightdope.com/u/Nature_s_Call)\
**Post date:** [December 20, 2012, 2:20pm UTC](https://boards.straightdope.com/t/i-suck-at-probability/644529/12 "2012-12-20T14:20:50Z")

</div>

> [@Sailboat](#):
>
> I think it’s funny (and also a classic example of how testing turns up the unexpected) that your simulator, written in part to test if dice were loaded, reveals that the computer pseudo-random number generator is, itself, “loaded.”

Even funnier, the actual game in question was played online. There were sufficient calls of “unfair dice” to prompt the developers of the game to post the [actual code](http://hcforums.icarusstudios.com/hcforums/showpost.php?p=10041&postcount=28) of the dice roll function.

> [@hibernicus](#):
>
> Interestingly, this question can’t be answered unless you know the probability of a given pair of dice being loaded.

Thanks for this - gave me a good pause for thought.

If the question is “what are the odds the dice are loaded” then you are correct.

But the question is “is it enough to raise suspicion?” More of a gut-check kind of thing. Irrespective of the number of loaded dice that exist, if the calculated odds were 0.000001% I would say “something is up here”. Given the odds are ~1% it’s definitely “lucky”, but in the gut-realm of picking 3 numbers in a 6/49 - it’s unlikely but it happens.

---

<div class="post-metadata">

**Author:** ![bldysabba](https://avatars.discourse-cdn.com/v4/letter/b/ecccb3/32.png) [@bldysabba](https://boards.straightdope.com/u/bldysabba)\
**Post date:** [December 20, 2012, 3:05pm UTC](https://boards.straightdope.com/t/i-suck-at-probability/644529/13 "2012-12-20T15:05:34Z")

</div>

> [@Nature\_s\_Call](#):
>
> Even funnier, the actual game in question was played online. There were sufficient calls of “unfair dice” to prompt the developers of the game to post the [actual code](http://hcforums.icarusstudios.com/hcforums/showpost.php?p=10041&postcount=28) of the dice roll function.
> 
> Thanks for this - gave me a good pause for thought.
> 
> If the question is “what are the odds the dice are loaded” then you are correct.
> 
> But the question is “is it enough to raise suspicion?” More of a gut-check kind of thing. Irrespective of the number of loaded dice that exist, if the calculated odds were 0.000001% I would say “something is up here”. Given the odds are ~1% it’s definitely “lucky”, but in the gut-realm of picking 3 numbers in a 6/49 - it’s unlikely but it happens.

What you’re feeling your way to is actually what most statistical inference is about. One more formal way of doing your gut-check is that you do a ‘sample’ number of ‘tests’. In this case, since the underlying distribution is known to us, we can calculate the expected value of the proportion of successes, as well as its standard deviation. These calculated values would be the ‘population’ mean and standard deviation. If the proportion of successes in the sample tests that you conducted deviates from the population mean by a given amount, you can say with some reasonable certainty that the dice is loaded. How much that amount is depends on how much certainty you want in your statement, and how many tests you conducted for your sample. So for instance, the deviation between your simulation and the calculated value can be used to check the likelihood of the simulator being ‘loaded’

---

<div class="post-metadata">

**Author:** ![septimus](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/septimus/32/410_2.png) [@septimus](https://boards.straightdope.com/u/septimus)\
**Post date:** [December 20, 2012, 3:43pm UTC](https://boards.straightdope.com/t/i-suck-at-probability/644529/14 "2012-12-20T15:43:17Z")

</div>

> [@Nature\_s\_Call](#):
>
> I let this run for 1 million iterations (took just over a minute). I’ve tried it a number of times and it seems to settle into about 1.18% This is higher than the calculated value of 0.996%. This likely reveals a “flaw” in the pseudo-random generator, but it’s pretty close.

Your simulator considers, in effect, 13 _or more_ passes (out of 15) to be a success, while the 0.996% figure cited upthread was for _exactly_ 13 passes out of 15. For the _13 or more_ criterion, 1.1887% is expected.

Crying “Flaw” on the pseudo-random generator should be a last resort, not first. 😉

---

<div class="post-metadata">

**Author:** ![Nature\_s\_Call](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/nature_s_call/32/19006_2.png) [@Nature\_s\_Call](https://boards.straightdope.com/u/Nature_s_Call)\
**Post date:** [December 20, 2012, 4:12pm UTC](https://boards.straightdope.com/t/i-suck-at-probability/644529/15 "2012-12-20T16:12:50Z")

</div>

Ah! I certainly was interested in 13 or more. And I haven’t yet read the wiki article on binomial distribution so I missed that detail on what **ultrafilter** actually calculated.

Adjusting the script, ran another 1 million iterations with the result of 0.9903. That’s more like it.

---

<div class="post-metadata">

**Author:** ![Nature\_s\_Call](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/nature_s_call/32/19006_2.png) [@Nature\_s\_Call](https://boards.straightdope.com/u/Nature_s_Call)\
**Post date:** [December 20, 2012, 7:36pm UTC](https://boards.straightdope.com/t/i-suck-at-probability/644529/16 "2012-12-20T19:36:15Z")

</div>

200 million iterations: 0.996%

---

<div class="post-metadata">

**Author:** ![BigT](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/bigt/32/12044_2.png) [@BigT](https://boards.straightdope.com/u/BigT)\
**Post date:** [December 21, 2012, 8:38pm UTC](https://boards.straightdope.com/t/i-suck-at-probability/644529/17 "2012-12-21T20:38:29Z")

</div>

> [@Nature\_s\_Call](#):
>
> Even funnier, the actual game in question was played online. There were sufficient calls of “unfair dice” to prompt the developers of the game to post the [actual code](http://hcforums.icarusstudios.com/hcforums/showpost.php?p=10041&postcount=28) of the dice roll function.

For some reason, I was expecting some complicated code, but that’s the most basic randomization possible, and I’m not sure I even recognize the language. It literally just says “Pick a number between 0 and 5, add 1, and then write it down.”
