10 examples of 'math.floor math.random' in JavaScript

Every line of 'math.floor math.random' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
78public static random(): number {
79 return math.random();
80}
10function math_random_int(a, b) {
11 if (a > b) {
12 // Swap a and b to ensure a is smaller.
13 var c = a;
14 a = b;
15 b = c;
16 }
17 return Math.floor(Math.random() * (b - a + 1) + a);
18}
14function random(max) {
15 var rand = Math.floor(Math.random() * max);
16 return rand;
17}
14function randomBetween(min, max, round) {
15 const num = Math.random() * (max - min + 1) + min
16
17 if (round) {
18 return Math.floor(num)
19 }
20 return num
21}
3function _random(max) {
4 return Math.round(Math.random()*1000)%max
5}
19function _random(max) {
20 return Math.round(Math.random() * 1000) % max;
21}
1function _random(max) {
2 return Math.round(Math.random()*1000)%max;
3}
51function random(from, to) {
52 return Math.floor(Math.random() * (to - from + 1) + from);
53}
270function random(max, min) {
271 return Math.round(Math.random() * (max - min) + min);
272}
190function MathRand() {
191 var myDate = new Date();
192 var mytime = myDate.getTime();
193 var Num = "";
194 for (var i = 0; i < 6; i++) {
195 Num += Math.floor(Math.random() * 10);
196 }
197 Num = Num + "-" + mytime;
198 return Num;
199};

Related snippets