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
TheexpressionMath.floor()//rounds a number down to the nearest integer.
11
+
TheexpressionMath.random()//generates a random floating-point number between 0 and 1.
12
+
Theexpression(maximum-minimum+1)//calculates the range of numbers between the minimum and maximum values.
13
+
TheexpressionMath.random()*(maximum-minimum+1)//generates a random floating-point number between 0 and the range of numbers.
14
+
TheexpressionMath.floor(Math.random()*(maximum-minimum+1))//rounds that random number down to the nearest integer, resulting in a random integer between 0 and the range of numbers.
15
+
Finally,addingminimumtothatresult//shifts the range to be between the minimum and maximum values.
16
16
// It will help to think about the order in which expressions are evaluated
17
17
// Try logging the value of num and running the program several times to build an idea of what the program is doing
0 commit comments