Skip to content

Commit e57f968

Browse files
authored
Improve comments for random number explanation
Clarify comments explaining the random number generation logic.
1 parent 22a0e1d commit e57f968

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,6 +6,6 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;
66
// In this exercise, you will need to work out what num represents?It gives us a random number between 1-100
77
// Try breaking down the expression and using documentation to explain what it means? + minimum shifts it between 1-100 so the minimum number is 1 and the biggest one is 100
88
//Math.random gives us a random number between 0-1 and the next parantecec returns 100
9-
//after that we multiple these two given values between 0-100 and the floor methode rounds down the given value
9+
//after that we multiple these two given values between 0-100 and the floor methode rounds down the given value and then adding 1(minimum) to the result.
1010
// It will help to think about the order in which expressions are evaluated
1111
// Try logging the value of num and running the program several times to build an idea of what the program is doing

0 commit comments

Comments
 (0)