Skip to content

Commit daab521

Browse files
committed
updating random.js
1 parent 80ba22b commit daab521

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Sprint-1/exercises/random.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,20 @@ const maximum = 100;
55
// console.log(num);
66

77

8-
// Math.floor() takes the integer Number
9-
// Math.random() will take a number between 1-100;
10-
11-
12-
138
// In this exercise, you will need to work out what num represents?
149
// Try breaking down the expression and using documentation to explain what it means
1510
// It will help to think about the order in which expressions are evaluated
1611
// Try logging the value of num and running the program several times to build an idea of what the program is doing
1712

13+
/* Math.floor() takes the integer Number
14+
Math.random() will take a number between 0 (inclusive) and 1 (no inclusive) eg. (0.345, 0,123)
15+
Math.random() * (maximum - minimum + 1): this multiply the random decimal number
16+
17+
18+
19+
1820

21+
// in this example taken from mdn we see the same function being called and will generate a random number between the minimun and maximun
1922

2023
function getRandomArbitrary(min, max) {
2124
return Math.random() * (max - min) + min;

0 commit comments

Comments
 (0)