File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,3 +7,15 @@ console.log(num);
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+ // 1. Math.random() produces a random decimal number in the range [0, 1).
12+ // 0 is included, but 1 is not included.
13+
14+ // 2. Math.random() * (maximum - minimum + 1) produces a random decimal
15+ // number in the range [0, 100), because maximum - minimum + 1 = 100.
16+
17+ // 3. Math.floor(Math.random() * (maximum - minimum + 1)) rounds the
18+ // decimal number down and produces a random whole number from 0 to 99.
19+
20+ // 4. Math.floor(Math.random() * (maximum - minimum + 1)) + minimum
21+ // adds 1 to the result, producing a random whole number from 1 to 100.
You can’t perform that action at this time.
0 commit comments