You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// In this exercise, you will need to work out what num represents?
8
10
// Try breaking down the expression and using documentation to explain what it mean
9
11
// It will help to think about the order in which expressions are evaluated
10
12
11
-
// Try logging the value of num and running the program several times to build an idea of what the program is doingnum reprents the number is randomly generated whole number betweeb 1 and 100,inclusive range is between 0 and 99.99999
12
-
13
-
//Math.random() returns a random decimal between 0(inclusive) and 1(exclusive). while maximum-minimum +1=100, Math.random()*(maximum-minimum+1)
13
+
// Try logging the value of num and running the program several times to build an idea of what the program is doing.
14
14
15
-
//Due to that Math.floor(...) rounds down the decimal to the nearest whole number.From this Stage, we have interger between o and 99.After + minimum, the range is between 1 and 100.
16
-
//This is classcial expressions for generating a random integer between two values- between 1 and 100, inclusive in this function.
15
+
//Math.random() returns a random decimal between 0(inclusive) and 1(exclusive). while maximum-minimum +1=100,+1 is important — it makes the range inclusive (so 100 is possible).
16
+
//Math.floor(...) rounds down the decimal to the nearest whole number.From this Stage, we have integer between o and 99.After + minimum, the range is between 1 and 100.
17
+
//num represents a random whole number between 1 and 100 (inclusive).It is the standard way to generate a random integer between min and max inclusive.
18
+
//This is classical expressions for generating a random integer between two values- between 1 and 100, inclusive in this function.
17
19
//This kind of expression is commonly used for things like: rolling dice,random quiz questions, game mechanics.
0 commit comments