Calculating odds distribution with 6-sided dice
- by Stephen
I'm trying to calculate the odds distribution of a changing number of 6-sided die rolls. For example, 3d6 ranges from 3 to 18 as follows:
3:1, 4:3, 5:6, 6:10, 7:15, 8:21, 9:25, 10:27, 11:27, 12:25, 13:21, 14:15, 15:10, 16:6, 17:3, 18:1
I wrote this php program to calculate it:
function distributionCalc($numberDice,$sides=6) {
for ( $i=0;…