Combinatorics, probability, dice

Posted by TarGz on Stack Overflow See other posts from Stack Overflow or by TarGz
Published on 2010-03-28T12:41:41Z Indexed on 2010/03/28 12:53 UTC
Read the original article Hit count: 526

Filed under:
|

A friend of mine asked: if I have two dice and I throw both of them, what is the most frequent sum (of the two dice' numbers)?

I wrote a small script:

from random import randrange
d = dict((i, 0) for i in range(2, 13))
for i in xrange(100000):
    d[randrange(1, 7) + randrange(1, 7)] += 1
print d

Which prints:

2:  2770,
3:  5547,
4:  8379,
5:  10972,
6:  13911,
7:  16610,
8:  14010,
9:  11138,
10: 8372,
11: 5545,
12: 2746

The question I have, why is 11 more frequent than 12? In both cases there is only one way (or two, if you count reverse too) how to get such sum (5 + 6, 6 + 6), so I expected the same probability..?

© Stack Overflow or respective owner

Related posts about combinatorics

Related posts about probability