NeoFaker.Boolean (neo_faker v0.9.0)
View SourceFunctions for generating boolean values.
This module provides utilities to generate random boolean values with configurable probabilities, allowing for controlled randomness.
Summary
Functions
Generates a random boolean value.
Functions
@spec boolean(pos_integer(), Keyword.t()) :: boolean() | non_neg_integer()
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