Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started