Skip to content

Commit e840f54

Browse files
committed
add comment on the explanation made on number 1.
1 parent 63b65ec commit e840f54

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ const maximum = 100;
33

44
const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;
55

6-
//1.num represents a number which is an Integer.
6+
//1.num represents a number which is an Integer that is greater or equal to 1.
7+
// That is because of the value of the minimum is 1.
78
//2.lets start by (maximum-minimum +1) which the output is 100.
89
//3.math.random()*100 returns random number between 0 and 100, what actually
910
// happens is that math.randum gives out random number from 0 to 1 which 1 is
1011
// not included and in this case, multiply the output by 100.
1112
//4.math.floor() gives out the largest intiger which is less than or equal to
12-
// the given number,which is decimal, which means it drops all the decimal. forexample if
13+
// the given number,which is decimal, which means it drops all the decimal. forexample if
1314
// the output is 69.5, it compares 69 with 69.5.The output will be 69 which is the largest Integer.
1415
//5.at the end we add 1 which is the minimum.
1516
console.log(num);

0 commit comments

Comments
 (0)