js rand php
function rand( min, max ) {
if( max ) {
return Math.floor(Math.random() * (max - min + 1)) + min;
} else {
return Math.floor(Math.random() * (min + 1));
}
}
работает точно также как и php аналог
alert(rand(1,100)) // вывести число от 1 до 100

