How to find the probability of a score from multiple dice with varying sides

467 Views Asked by At

I'm trying to find a general method for working out the probability of a score from rolling several dice with varying sides.

For example, the probability of getting a result of 12 when rolling two six-sided dice and three 100-sided dice.

I'm a programmer looking to use this formula for a function, so please be gentle. Thanks!

2

There are 2 best solutions below

1
On

I found a solution to this specific problem by treating each dice roll as a one-dimensional array containing the probability distribution, and then convolving the arrays into a single distribution.

I've uploaded a demonstration here.

0
On

Try to manipulate a generating function that represent the dice that you want following the example on this link.

For your example the generating function will be

$$f(x)=(x+x^2+\cdots+x^{D_\alpha})^{n_\alpha}\cdot(x+x^2+\cdots+x^{D_\beta})^{n_\beta}\cdots(x+x^2+\cdots+x^{D_\omega})^{n_\omega}$$

where $D_i$ is the number of sides of the dice and $n_i$ is the number of dice of each type rolled. This is for homogeneous and fair dice from 1 to D, for other type of dice you must change the function.