A Dice Roller with trials

= count($allRolls) ) { return; } echo " \n"; echo " "; $temp_sum = 0; $temp_max = 0; $temp_min = 9999; for ($i = 0; $i < $num_dice; $i++) { echo $allRolls[$start][$i]." "; $temp_sum += $allRolls[$start][$i]; $temp_max = max($temp_max, $allRolls[$start][$i]); $temp_min = min($temp_min, $allRolls[$start][$i]); } echo "\n"; echo " ".$temp_sum."\n"; echo " ".$temp_max."\n"; echo " ".$temp_min."\n"; echo " \n"; $maxSum += $temp_max; $minSum += $temp_min; return; } for ($g = 0; $g < $GAMES; $g++) { $temp_rolls = 0; $currentRoll = array(); while ($temp_rolls < $num_dice) { $currentRoll[] = roll(); $temp_rolls++; } $allRolls[] = $currentRoll; } // for each game // Calculate the average number of rolls needed to get Yahtzee $averageRolls = 0; for ($i = 0; $i < count($allRolls); $i++) { for ($j = 0; $j < $num_dice; $j++) { $averageRolls += $allRolls[$i][$j]; } } $averageRolls /= $GAMES; ?> The average roll is 0.

Rolls Sum Max Min

The average max is 0.

The average min is 0.
Number of Dice:
Number of Sides on a Die:
Rolls: