Skip to content

Commit 2250a8f

Browse files
committed
answer 4_raondom and floor
1 parent 48ef768 commit 2250a8f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ 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-
// Here, Math.rondom creates a random number between 0 to 1 and Math.floor rounds donw to the nearest integer.
11+
// Here, Math.rondom creates a random number which is greater than or equals to 0 and less than 1.
12+
// Math.floor rounds down to the nearest integer which is less than or equals to a given number
1213
// When creating a random number between 0 and 1, we will multiply it by the (100 - 1 + 1), then round it down to the nearest integer
13-
// Then add all of that to 1.
14+
// Then add all of that to 1 which is the minimun.
1415

0 commit comments

Comments
 (0)