Posted By

liakwee on 01/31/10


Tagged

random as3


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

davidino1978


Random number with range


 / Published in: ActionScript 3
 

  1. function randomNumber(low:int = 0, high:int = 0):int{
  2. var low:int = low;
  3. var high:int = high;
  4.  
  5. if(low == high)
  6. throw new Error("low & high value must be the same");
  7.  
  8. return Math.round(Math.random() * (high - low)) + low;
  9. }

Report this snippet  

You need to login to post a comment.