const getRandomNumberBetween = (min, max) => {
return Math.floor(Math.random() * (max - min + 1) + min)
}
const randomNumber = getRandomNumberBetween(1,1000)
//in npm, type npm install random-int
import randomInteger from 'random-int';
randomInteger(5);
//=> 3
randomInteger(10, 100);
//=> 54
Math.floor(Math.random() * max)
const crypto = require('crypto');
const otp = crypto.randomInt(1000, 9999);
console.log(otp) //generate random 4 pin