the JavaScript random function,returns a random number between zero and one.

To change it into a whole number first resize it by multiplying by the largest whol enumbr you want, then apply the round() function.

To generate a whole number between 0 and 10

val= Math.round((Math.random()*10);To generate a whole number between 1 and 10, generate a numbr from 0 to 9 and add 1:

val= Math.round((Math.random()*9)+1;

This form

uses this function:function randommax(n){ // return a random integer between 0 and n return Math.round(n*Math.random()); }Stephen Woodruff