File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -7,3 +7,13 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;
77// Try breaking down the expression and using documentation to explain what it means
88// It will help to think about the order in which expressions are evaluated
99// Try logging the value of num and running the program several times to build an idea of what the program is doing
10+
11+ //ANSWER
12+ // const minimum = 1 sets the minimum value to 1
13+ // const maximum = 100 sets the maximum value to 100
14+ //Math.random() generates a random decimal number, zero inclusive but not 1.
15+ // (maximum - minimum + 1) calculates how many whole numbers maximum and minimum
16+ // Math.random() * (maximum - minimum + 1) ensures that the random decimal is within the desired range.
17+ // Math.floor(...) rounds the number down to the nearest whole integer
18+ // + minimum shifts the range upward so it starts at minimum instead of 0
19+ // The program generated random numbers from 0 to 100 as whole integers.
You can’t perform that action at this time.
0 commit comments