//The number after the asterisk is the range from which the random number will come
//A random number between 1 and 100, since i’m using an int there will be no .whatever
var randomNumber:int = Math.random()*100;
trace(randomNumber);

/// with a range and I’m told with a better value distribution

var lowVal:int = 100;
var highVal:int = 201;

var randomNumber:int = ( Math.random() * (1+highVal-lowVal) ) + lowVal;

trace(randomNumber);

Comment Feed

No Responses (yet)



Some HTML is OK

or, reply to this post via trackback.