Every line of 'random number 1-36' 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.
294 export function randomNumber(lessThan = 52) { 295 const seed = Math.random(); 296 return parseInt(seed * lessThan); 297 }
6 function randomNumber() { 7 return parseInt(Math.random() * 100, 10); 8 }
68 function randomNumber(boundary) { 69 return parseInt(Math.random() * boundary); 70 //return Math.floor(Math.random() * boundary); 71 }
26 function random() { 27 return Math.random().toString(36).substr(2); 28 }
14 function RandomHexDigit(allow_zero) { 15 const chars = allow_zero ? '0123456789ABCDEF' : '123456789ABCDEF'; 16 return chars.charAt(Math.floor(Math.random() * chars.length)); 17 }
4 function randomNumber() { 5 return Math.floor(Math.random()*100) 6 }
664 function random11() { 665 666 return random(-1, 1, true); 667 668 }
34 export function generateNumber(min,max){ 35 if(min==null) 36 min=Number.MIN_SAFE_INTEGER 37 if(max==null) 38 max=Number.MAX_SAFE_INTEGER 39 return ((Math.random() * (max - min) ) + min).toString(); 40 }
104 function random2() { 105 return (Math.random() * 2) | 0; 106 }
51 function random (n){ 52 if(typeof n === 'object'){ 53 var times = n[1]-n[0]; 54 var offset = n[0]; 55 return Math.random()*times + offset; 56 }else{ 57 return n; 58 } 59 }