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 randomNumber(min, max) {
2 return Math.floor(Math.random() * (max - min)) + min;
3}
1Math.floor((Math.random() * 100) + 1);
2//Generate random numbers between 1 and 100
3//Math.random generates [0,1)
1var random;
2var max = 8
3function findRandom() {
4 random = Math.floor(Math.random() * max) //Finds number between 0 - max
5 console.log(random)
6}
7findRandom()