We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
0 parents commit ac8ef3bCopy full SHA for ac8ef3b
README.md
@@ -0,0 +1,20 @@
1
+# JavaScript-snippets
2
+JavaScript Snippets
3
+
4
+```javascript
5
+// Returns a random number between min (inclusive) and max (exclusive)
6
7
+const getRandomNumber = (min, max) => Math.random() * (max - min) + min;
8
9
+getRandomNumber(2, 10)
10
11
+ // Returns a random number between min (inclusive) and max (inclusive)
12
13
+const getRandomNumberInclusive =(min, max)=> {
14
+ min = Math.ceil(min);
15
+ max = Math.floor(max);
16
+ return Math.floor(Math.random() * (max - min + 1)) + min;
17
+}
18
19
+getRandomNumberInclusive(2, 10);
20
+```
0 commit comments