Returns the boolean value true or false.
Note:
A probability of 0.75
results in true
being returned 75%
of the calls; likewise 0.3
=> 30%
.
If the probability is <= 0.0
, it will always return false
.
If the probability is >= 1.0
, it will always return true
.
The probability is limited to two decimal places.
Optional
options: number | { probability?: number }The optional options object or the probability ([0.00, 1.00]
) of returning true
.
Optional
probability?: numberThe probability ([0.00, 1.00]
) of returning true
.
Module to generate boolean values.
Overview
For a simple random true or false value, use
boolean()
.