0
Q:

javascript random number

Math.floor(Math.random() * 6) + 1  
14
function getRandomNumberBetween(min,max){
    return Math.floor(Math.random()*(max-min+1)+min);
}

//usage example: getRandomNumberBetween(20,400); 
25
var random;
var max = 8
function findRandom() {
  random = Math.floor(Math.random() * max) //Finds number between 0 - max
  console.log(random)
}
findRandom()
7
var RandomNumber = Math.ceil(Math.random() * 100);              
// Returns a random number between 1 and 100
5

Math.floor(Math.random() * 100);     // returns a 
  random integer from 0 to 99
 
1
  let replies = [
    "1",
    "2",
    "3",
    "4",
    "5",
    "6",
    "7",
    "8",
    "9",
    "10",
    "11",
    "12"
  ];

  let result = Math.floor(Math.random() * replies.length);
1
Math.random() * 10 = 0-10
1
var randomNo = Math.floor(Math.rand() * 10000000001);
console.log(randomNo);

//This will generate random number
0
function getTotal(){
    var total=0;
    for(let t=0; t<array.length; t++){
        total+= array[t].randomNum;
-1

New to Communities?

Join the community