Function: random_boolean

Function: random_boolean

since 0.3.8



Returns a random bool, either true or false. The parameter is the probability of returning true, so random_boolean(0.0) always returns true, random_boolean(1.0) always returns false and random_boolean(0.5) simulates a fair coin toss.

Since the result is random, calling the function twice will give a different answer.


Parameter Type Default Description
input real number 0.5 Probability of returining true


 random_boolean(0.5) == true
 random_boolean(0.5) == false

See also

random_real Generate a random real number.