генерировать случайное число Nodejs
function getRandomNumberBetween(min,max){
return Math.floor(Math.random()*(max-min+1)+min);
}
Old-fashioned Oryx
function getRandomNumberBetween(min,max){
return Math.floor(Math.random()*(max-min+1)+min);
}
/**
* Gets random int
* @param min
* @param max
* @returns random int - min & max inclusive
*/
getRandomInt(min, max) : number{
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
}
const getRandomNumberBetween = (min, max) => {
return Math.floor(Math.random() * (max - min + 1) + min)
}
const randomNumber = getRandomNumberBetween(1,1000)
Math.floor(Math.random() * max)
const crypto = require('crypto');
const otp = crypto.randomInt(1000, 9999);
console.log(otp) //generate random 4 pin