1// Genereates a number between 0 to 1;
2Math.random();
3
4// to gerate a randome rounded number between 1 to 10;
5var theRandomNumber = Math.floor(Math.random() * 10) + 1;1//To genereate a number between 0-1
2Math.random();
3//To generate a number that is a whole number rounded down
4Math.floor(Math.random())
5/*To generate a number that is a whole number rounded down between
61 and 10 */
7Math.floor(Math.random() * 10) + 1 //the + 1 makes it so its not 0.1function getRandomNumberBetween(min,max){
2    return Math.floor(Math.random()*(max-min+1)+min);
3}
4
5//usage example: getRandomNumberBetween(20,400); 
61//Returns a number between 1 and 0
2  console.log(Math.random());
3  
4//if you want a random number between two particular numbers, 
5//you can use this function
6  function getRandomBetween(min, max) {
7    return Math.random() * (max - min) + min;
8  }
9//Returns a random number between 20 and 170
10  console.log(getRandomBetween(20,170));
11  
12//if you want a random integer number from one number to another 
13//(including the min and the max numbers), you can use this function
14  function getRandomIntBetween(min, max) {
15    min = Math.ceil(min);
16    max = Math.floor(max);
17    return Math.floor(Math.random() * (max - min + 1)) + min;
18  }
19  
20//Returns a random integer number from 0 to 25
21  console.log(getRandomIntInclusive(0,25));