Random

Math.random() generates a random number between 0 and 0.999...

0.8706439702609821

Math.random() * 10 generates a random number between 0 and 9.999...

8.70643970260982

Math.floor(Math.random() * 10) generates a random whole number between 0 and 9

8

To generate a random number in a different range, multiply Math.random() by a different number.