Datatype
For a simple random true or false value, use
boolean()
.boolean
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.Name | Type | Default | Description |
---|---|---|---|
probability | number | 0.5 | TThe probability ([0.00, 1.00] ) of returning true . |
faker.datatype.boolean(0.9)
used a positional argument 0.9
to specify the probability of returning True
.probability
. The equivalent function call is now {{ $datatype.boolean(probability=0.9) }}
.Modified atΒ 2024-08-30 09:27:36