Question: The following expression returns a random number between 1 and 6 inclusive, i.e., it simulates a die (singular of dice) roll. 1 Math.floor((Math.random() * 6)
The following expression returns a random number between 1 and 6 inclusive, i.e., it simulates a die (singular of dice) roll.
| 1 | Math.floor((Math.random() * 6) + 1) |
Use this expression to simulate rolling a die 60,000 times and display the frequency with which each face of the die finishes uppermost.
Use 6 variables to capture the frequencies and a 6-way if-else-if control structure need in the loop to increment them appropriately.
Display the results neatly as below. Note your frequencies for the rolls will be different.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
