Skip to content

Commit 2b99e8c

Browse files
Enhance comments for clarity on random number generation logic
1 parent 88beb1f commit 2b99e8c

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
@@ -6,7 +6,7 @@ const maximum = 100; // Sets the highest possible number that can be generated
66
// Try breaking down the expression and using documentation to explain what it means
77
// It will help to think about the order in which expressions are evaluated
88

9-
const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;
9+
const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; // calculates the total count of all possible whole numbers between minimum and maximum.
1010
// Math.random() returns a random decimal between 0 and 1
1111
// Math.random() * maximum(100) returns a random decimal between 0 and 99.999
1212
// Math.floor() rounds up the decimal to the nearest whole number

0 commit comments

Comments
 (0)