Generating a random number is often useful when developing applications in AS3 (more so when developing games). AS3 has a built in random number method as a part of it's Math class which generates a number less than 1 and greater than or equal to 0. We can use this to create a useful function for generating a random number between two other numbers.
- function random(min:Number, max:Number):Number
- return min + Math.random() * (max - min);
CommentsSubscribe to comments
You need to login to post a comment.