Wednesday, February 27, 2008

wed 11PM

rand number in JS:
var randomnumber=Math.floor(Math.random()*11)

for 0-10

http://www.javascriptkit.com/javatutors/randomnum.shtml


in a range:
function getRandom(min, max) {
var randomnumber= Math.floor(Math.random()*(max-min))+min;
console.log(randomnumber);
return randomnumber;
}

No comments: