Math.floor(Math.random() * 6) + 1
function getRandomNumberBetween(min,max){ return Math.floor(Math.random()*(max-min+1)+min); } //usage example: getRandomNumberBetween(20,400);
var random; var max = 8 function findRandom() { random = Math.floor(Math.random() * max) //Finds number between 0 - max console.log(random) } findRandom()
var RandomNumber = Math.ceil(Math.random() * 100); // Returns a random number between 1 and 100
Math.floor(Math.random() * 100); // returns a random integer from 0 to 99
let replies = [ "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" ]; let result = Math.floor(Math.random() * replies.length);
Math.random() * 10 = 0-10
var randomNo = Math.floor(Math.rand() * 10000000001); console.log(randomNo); //This will generate random number
function getTotal(){ var total=0; for(let t=0; t<array.length; t++){ total+= array[t].randomNum;