EverFaker (ever_faker v0.1.0)

View Source

Main module to start application with some helper functions.

Summary

Functions

Returns application country.

Internal function to format string.

Returns application locale.

Sets application locale.

Returns application locale ready for module construct.

Returns a (pseudo) random number as an integer between the range intervals.

Returns a random bytes.

Returns a random float in the value range 0.0 =< x < 1.0.

Returns a shuffled enum.

Starts EverFaker with default locale.

Starts EverFaker with lang locale.

Functions

country()

@spec country() :: atom()

Returns application country.

format(str)

@spec format(String.t()) :: String.t()

Internal function to format string.

It replaces "#" to random number and "?" to random Latin letter.

locale()

@spec locale() :: atom()

Returns application locale.

locale(lang)

@spec locale(atom()) :: :ok

Sets application locale.

localize(function)

(macro)

mlocale()

@spec mlocale() :: String.t()

Returns application locale ready for module construct.

random_between(left, right)

@spec random_between(integer(), integer()) :: integer()

Returns a (pseudo) random number as an integer between the range intervals.

Examples

iex> random_between(3, 7) in [3, 4, 5, 6, 7]
true

random_bytes(total)

@spec random_bytes(pos_integer()) :: binary()

Returns a random bytes.

random_uniform()

@spec random_uniform() :: float()

Returns a random float in the value range 0.0 =< x < 1.0.

Examples

iex> is_float(random_uniform())
true

sampler(name, data)

(macro)

shuffle(enum)

@spec shuffle(Enum.t()) :: list()

Returns a shuffled enum.

start()

@spec start() :: :ok

Starts EverFaker with default locale.

start(lang)

@spec start(atom()) :: :ok

Starts EverFaker with lang locale.