Posted By

Activetuts on 01/13/11


Tagged


Versions (?)

Who likes this?

12 people have marked this snippet as a favorite

chus
EderChrono
toxin20
liakwee
ichnoweb
kure69
AndrewPotter
JaaQ
im3der
elderhsouza
redconservatory
flashdeveloper


Random Boolean


 / Published in: ActionScript 3
 

URL: http://enva.to/e4ig6z

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.

  1. function get randomBoolean():Boolean
  2. {
  3. return Math.random() >= 0.5;
  4. }

Report this snippet  

You need to login to post a comment.