There was an error while loading. Please reload this page.
1 parent 4c43955 commit 71bd055Copy full SHA for 71bd055
1 file changed
Sprint-2/1-key-exercises/4-random.js
@@ -7,3 +7,9 @@ const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;
7
// Try breaking down the expression and using documentation to explain what it means
8
// It will help to think about the order in which expressions are evaluated
9
// Try logging the value of num and running the program several times to build an idea of what the program is doing
10
+
11
+//num represents a random whole number between 1 and 100
12
+// Math.random() produces a random decimal from 0 up to 1 .
13
+// Math.random() * 100 produces a decimal from 0 up to 100.
14
+// Math.floor() rounds the number down to a whole number, giving 0–99.
15
+// +minimum (+1) shifts that range to 1–100.
0 commit comments