AS3 Helper Class – RandomBoolean
We are building an AS3 Helper class to speed up development on Actionscript 3 projects. Feel free to use these methods in your own Helper class, or to share your own methods that you find useful.
RandomBoolean()
1
2
3
4
5
6
7
8
9
10
public class Helper
{
/**
* Returns Boolean true or false, randomly.
*/
public static function RandomBoolean():Boolean
{
return Boolean(Math.floor(Math.random() * 2));
}
}
Usage
1
var coinTossIsHeads:Boolean = [...] Keep Reading



