What is the most likely dice roll?

Probably common sense, but this statistically supports the most common roll of the dice. Of course, this assumes physical normalcy of the die, not loaded, etc. 🙂

[root@cmhlcanlyodb01 ~]# cat rand.py
import random
d = dict()
for i in range(1,100001):
  j=random.randint(1,6)
  k=random.randint(1,6)
  l=j+k
  if l in d:
    d[l] = d[l] + 1
  else:
    d[l] = 1

for a in d:
  print str(a).rjust(10,' '),str(d[a]).rjust(10,' '),
        str(round(float(d[a])*100/float(100001),1)).rjust(10,' ')
[root@cmhlcanlyodb01 ~]# python rand.py
         2       2739        2.7
         3       5568        5.6
         4       8320        8.3
         5      11355       11.4
         6      13765       13.8
         7      16830       16.8
         8      13695       13.7
         9      10991       11.0
        10       8269        8.3
        11       5687        5.7
        12       2781        2.8
[root@cmhlcanlyodb01 ~]#

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.