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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!