/ Published in: ActionScript 3

Always need one of these on hand. Feed it a minimum number and a maximum number and it returns a random within that range. Super useful.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// usage trace( randRange( 1, 10 )); function randRange( minNum:Number, maxNum:Number ) : Number { return (Math.floor(Math.random() * (maxNum - minNum + 1)) + minNum); }
Comments
