We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b871d11 commit fe1bc4fCopy full SHA for fe1bc4f
1 file changed
basic/generate_number.js
@@ -0,0 +1,12 @@
1
+function getRandomInt(max) {
2
+ return Math.floor(Math.random() * max);
3
+}
4
+
5
+console.log(getRandomInt(3));
6
+// Expected output: 0, 1 or 2
7
8
+console.log(getRandomInt(1));
9
+// Expected output: 0
10
11
+console.log(Math.random());
12
+// Expected output: a number from 0 to <1
0 commit comments