Skip to content

Commit 238ca63

Browse files
committed
4-randoms commit
1 parent 62f02e4 commit 238ca63

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,8 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;
77
// Try breaking down the expression and using documentation to explain what it means
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
10+
11+
// Here, Math.rondom creates a random number between 0 to 1 and Math.floor rounds donw to the nearest integer.
12+
// 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+

0 commit comments

Comments
 (0)