Skip to content

Commit 60d1f16

Browse files
committed
fix explanation Explain Math.random() range
1 parent 896bdbc commit 60d1f16

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎Sprint-2/1-key-exercises/4-random.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;
99
// Try logging the value of num and running the program several times to build an idea of what the program is doing
1010
console.log(num);
1111
// num is a random whole number between minimum and maximum.
12-
// Math.random() gives a decimal between 0 and 1.
12+
// Math.random() returns a number that's greater than or equal to 0 and less than 1.
1313
// Then we multiply by (maximum - minimum + 1) to get a range of possible values.
1414
// Math.floor(...) turns that into a whole number.
1515
// Finally, we add minimum so the number starts at minimum instead of 0.

0 commit comments

Comments
 (0)