NeoFaker.Boolean (neo_faker v0.7.1)
View SourceProvides functions for generating boolean values.
This module includes functions to generate random boolean values with configurable probabilities, allowing for controlled randomness in various use cases.
Summary
Functions
Generates a random boolean value.
Functions
@spec boolean(pos_integer(), Keyword.t()) :: boolean()
Generates a random boolean value.
By default, this function returns true
or false
with equal probability (50% each).
An optional true_ratio
argument can be provided to adjust the probability of returning true
.
If the integer: true
option is set, the function returns 1
for true
and 0
for false
.
Examples
iex> NeoFaker.Boolean.boolean()
false
iex> NeoFaker.Boolean.boolean(75)
true
iex> NeoFaker.Boolean.boolean(75, integer: true)
1