[Math] Custom dice roll probability formula

probability

I want to make an application that gives you the probability of reaching a certain threshold with a number of rolls of special dice. Just to clarify, I am not asking for help on programming, I need a formula to program from.

The variables are

  • d: the number of dice, all with the sides [1, 2, 2, 3, 3, 4]

  • x: the number the roll needs to reach

I need to work out the probability of rolling d dice (of the special type noted above) and getting a total equal to or greater than x

Best Answer

Let $p(t,d)$ be the probability that when you roll $d$ dice, the sum of their numbers is exactly $t.$

Then $p(t,d) = 0$ whenever $t < 0.$ Also $p(t,0) = 0$ when $t > 0,$ but $p(0,0) = 1.$

For $d \geq 0,$ $$p(t,d+1) = \frac16 p(t-1,d) + \frac13 p(t-2,d) + \frac13 p(t-3,d) + \frac16 p(t-4,d).$$

You can use that formula to find any value of $p(t,d)$ recursively. An efficient way to do this is to compute $p(t,1)$ for every relevant value of $t,$ then $p(t,2)$ for every relevant $t,$ and so forth until you have computed the necessary values of $p(t,d)$ in order to find the probability of rolling at least $x$; that probability is $$ \sum_{t\geq x} p(t,d).$$