File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -7,3 +7,14 @@ 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+ console . log ( num ) ;
12+
13+ // I understand that Math.random() generates a random number between 0 and 1,
14+ // and multiplies it by the range (maximum - minimum + 1) to get a number in that range.
15+ // and then adds the minimum to shift the range to start from the minimum value 1 -> 100 rather than 0 -> 99.
16+ // finally, Math.floor() rounds the number down.
17+
18+ // docs for Math.random() and Math.floor() I used:
19+ // https://www.google.com/search?q=Math.random+mdn
20+ // https://www.google.com/search?q=Math.floor+mdn
You can’t perform that action at this time.
0 commit comments