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
{{ message }}
Repository navigation
Commit d93a91d
Browse filesBrowse the repository at this point in the historyBrowse files
//- "num" represents a random whole number between 1 and 100.
13
13
//Break down of expression
14
-
//-Math.random: This generates a random decimal number between 0 and 1. It can return 0, but never reaches 1. (Example: 0.87).
14
+
//-Math.random: This generates a random decimal number between 0 and 1. It can return 0, but never reaches 1. (Example: 0.876).
15
15
//-(maximum - minimum + 1):
16
16
// This expression can be simplified as (100 - 1 + 1), which equals 100. This tells the program how many possible whole numbers there are. There are 100 possibilities.
17
-
// The +1 is important as without it, we would only reach 99 possibilities, that is 0 - 99.
17
+
// The +1 is important as without it, we would only reach 99 possibilities, that is 0 - 99.
18
+
//-Math.random() * (maximum - minimum + 1):
19
+
// This function multiplies the random fraction by the range size. Since Math.random() represents numbers >=0 and <1, this expression produces value anywhere from 0 up to 100, excluding 100.
20
+
// Example to justify expression: 0.876 * 100 = 87.6
0 commit comments