NeoFaker.Boolean (neo_faker v0.13.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 with a configurable probability of returning true.
Functions
@spec boolean(0..100, Keyword.t()) :: boolean() | non_neg_integer()
Generates a random boolean value with a configurable probability of returning true.
By default, returns true or false with equal probability. The true_ratio parameter sets
the percentage chance (0–100) of returning true. If the integer: true option is provided,
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