A Random Number Generator Simulation with trials

count($results)) { // print out however many we can $numGames = count($results) - $start; } // rough error checking if ($start < 0 || $start > count($results) || $numGames < 1) { return; } if ($numGames == 1) { echo " \n"; echo " ".($start+1)."\n"; echo " ".$results[$start]."\n"; echo " \n"; return; } // print out multiple games at a time $tempSum = 0; for ($i = 0; $i < $numGames; $i++) { $tempSum += $results[$start + $i]; } echo " \n"; echo " ".($start+1)." - ".($start+$numGames)."\n"; echo " ".$tempSum."\n"; echo " \n"; return; } for ($g = 0; $g < $GAMES; $g++) { $temp_sum = 0; for ($i = 0; $i < $num_rolls; $i++) { $temp_sum += roll(); } $temp_average = round($temp_sum/$num_rolls, 0); $total_sum += $temp_sum; $results[$temp_average]++; } // for each game // Calculate the overall average ?> The overall average of all the rolls was NAN.

Average Frequency
Number of Times to Roll:
Maximum Roll Value:
Trials:
Lines to print together: