1var randomWholeNumber = Math.floor(Math.random() * 20);
2
3
4function randomWholeNum() {
5
6 return Math.floor(Math.random() * 10);
7
8}
9
10console.log(randomWholeNum());
1/* If 1 argument is given, minimum will be set to 0 and maximum to this argument
2 * If 2 arguments were given, the fist would be the minimum and the second the maximum
3 * The function will return an integer in [min, max[
4 */
5const Math.randint => (min,max) {
6 [min,max] = (max===undefined)?[0,min]:(min>max)[max,min]:[min,max];
7 return Math.floor(Math.random*(max-min)+min);
8}