File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,13 @@ const maximum = 100;
44const num = Math . floor ( Math . random ( ) * ( maximum - minimum + 1 ) ) + minimum ;
55
66// In this exercise, you will need to work out what num represents?
7- // Try breaking down the expression and using documentation to explain what it means
7+ // Try breaking down the expression and using documentation to explain what it mean
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+ num reprents the number is randomly generated whole number betweeb 1 and 100 , inclusive
11+ Math . random ( ) returns a random decimal between 0 ( inclusive ) and 1 ( exclusive ) . while maximum - minimum + 1 = 100 , Math . random ( ) * ( maximum - matchMedia + 1 )
12+ range is between 0 and 99.99999
13+ Due to that Math . floor ( ...) rounds down the decimal to the nearest whole number . From this Stage , we have interger between o and 99.
14+ After + minimum , the range is between 1 and 100.
15+ This is classcial expressions for generating a random interger between two values - between 1 and 100 , inclusive in this function .
16+ This kind of expression is commonly used for things like : rolling dice , random quiz questions , game mechanics .
You can’t perform that action at this time.
0 commit comments