Every line of 'random number 200 to 2000' 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.
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 }
Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code
1 export default function random(min = 1000, max = 4000) { 2 const val = Math.random() * 1000 * 10; 3 4 if (val < min) { 5 return min; 6 } 7 8 if (val > max) { 9 return max; 10 } 11 12 return val; 13 }
8 function randomNumber(min, max) { 9 return Math.floor(Math.random() * (max - min + 1)) + min; 10 }
664 function random11() { 665 666 return random(-1, 1, true); 667 668 }
87 function randNum (max) { 88 return faker.random.number({min: 1, max: max || 5}) 89 }
4 function randomNumber(min, max) { 5 return Math.random() * (max - min) + min; 6 }
82 function randomNumber(min, max) { 83 return Math.random() * (max - min) + min; 84 }
68 function randomNumber(boundary) { 69 return parseInt(Math.random() * boundary); 70 //return Math.floor(Math.random() * boundary); 71 }
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 }