Dice sum probability

171 Views Asked by At

Simulate two separate dice (use random numbers with the appropriate range) being rolled 10 times. What are the percentage of rolls that resulted in a sum of 7, a sum of 2 and a sum of 11.

I came across this problem and have spent ages trying to figure out the algorithm for this...any help would be appreciated. I would show you what I came up with but i have nothing...

2

There are 2 best solutions below

1
On

You need a random number generator that gives a uniform distribution on $[1,6]$ to be a die. Then loop from $1$ to $10$, rolling two dice each time. Total the dice and count the times you get $2, 7, 11$. Report the results

0
On

This looks like a programming exercise rather than a math exercise. Specifics will depend on your programming language, but it is going to be something like

n2 = n7 = n11 = 0;
for i = 1 to 10 do
  d1 = random(1,6) // get a random integer between 1 and 6
  d2 = random(1,6) // and another one
  s = d1 + d2
  if s == 2 then n2 = n2 + 1; fi
  if s == 7 then n7 = n7 + 1; fi
  if s == 11 then n11 = n11 + 1; fi
od
print "2's:  ", 10 * n2, "%"
print "7's:  ", 10 * n7, "%"
print "11's: ", 10 * n11, "%"

It's much more fun to try to figure out the expected number of 2's, 7's and 11's, but I'll leave that as (another) exercise.