Every line of 'javascript 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.
51 function random(from, to) { 52 return Math.floor(Math.random() * (to - from + 1) + from); 53 }
10 function 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 }
13 export function floor([number]) { 14 return Math.floor(number); 15 }
73 function floor(number) { 74 return Math.floor(number * 10) / 10; 75 }
190 function 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 };
5 static randomInt() { 6 return Math.floor(Math.random() * Number.MAX_SAFE_INTEGER); 7 }
109 function randomInt(a, b) 110 { 111 assert ( 112 isInt(a) && isInt(b) && a <= b, 113 'invalid params to randomInt' 114 ); 115 116 var range = b - a; 117 118 var rnd = a + Math.floor(Math.random() * (range + 1)); 119 120 return rnd; 121 }
78 public static random(): number { 79 return math.random(); 80 }
15 export function getRandomInt(min = 0, max = 100) { 16 min = Math.ceil(min); 17 max = Math.floor(max); 18 return Math.floor(Math.random() * (max - min + 1)) + min; 19 }
162 function random999(){ 163 let a = Math.ceil(Math.random()*1000); 164 if(a>99){ 165 return a; 166 }else{ 167 if(a>9){ 168 return '0'+a; 169 }else{ 170 return '00'+a; 171 } 172 } 173 }