Random value generators
Summary
Functions
Get a random boolean value.
Get a random integer value between 1 and max (inclusive).
Get a random integer value within the given range.
Get a random string of given length.
Functions
@spec boolean() :: boolean()
Get a random boolean value.
Example
iex> ExUtils.Random.boolean()
true
@spec integer(pos_integer()) :: pos_integer()
Get a random integer value between 1 and max (inclusive).
If you want to get a value within a custom range, see integer/2.
Example
iex> ExUtils.Random.integer(10)
7
Get a random integer value within the given range.
Also see integer/1.
Example
iex> ExUtils.Random.integer(5, 10)
8
@spec string(pos_integer()) :: binary()
Get a random string of given length.
The default length is 10 characters.
Examples
iex> ExUtils.Random.string()
"q4mRy_YGXa"
iex> ExUtils.Random.string(5)
"Bk9p_"