Skip to content

Commit 3dbdc7f

Browse files
committed
Clarified comment on random number generation
1 parent 9718716 commit 3dbdc7f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;
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
1010

11-
//Math.random() returns a random number between 0 and 1 but not including 1. By multiplying by (maximum-minimum +1) we get a random number between 0 and 100.
11+
//Math.random() returns a random number between [0,1) meaning 0 inclusive and 1 exclusive. By multiplying by (maximum-minimum +1) we get a random number between 0 and 100.
1212
// The answer could however be in decimal point, thereofor by using Math.floor() we round down to the nearest whole number, but that would give us a range between 0 and 99. Adding minimum (1) to the result gives us a range between 1 and 100 inclusive.

0 commit comments

Comments
 (0)