/ Published in: ActionScript 3
Similarly to needing a random number, you may also require a random Boolean for use in an expression. Again we use the random method of the Math class to simply return true if random() generates a number greater than or equal to 0.5 or false if less.
Expand |
Embed | Plain Text
function get randomBoolean():Boolean { return Math.random() >= 0.5; }
You need to login to post a comment.
