Learn Create Your Own Split Screen

Next Page

If you want an Integer (whole number) random number in a range, you just generate a non-integer random number and then keep the integer portion of it, using another Math function:
var thing = Math.floor(Math.random() * 20);
After this line of code, the 'thing' variable might contain values similar to the following:

       Not 0.19287346, but 0
       Not 7.5243, but 7
       Not 19.993873, but 19
       Not 3.00003873, but 3 
In other words, we get whole numbers between 0 and 19, inclusive.

If we wanted between 1 and 20 inclusive, we'd use this:

var thing = (Math.floor(Math.random()*20)) + 1;