NeoFaker is a package for generating fake data in Elixir.
This module provides the main interface for starting the application and seeding the random
number generator. See NeoFaker.Locale for managing locale configuration.
Locale support
Many modules accept a :locale option. Use NeoFaker.Locale.set/1 to override the locale for
the calling process, or pass locale: per call. To set a locale for the whole application
instead (e.g. for a Phoenix app), configure config :neo_faker, locale: ..., then see
Getting Started.
iex> NeoFaker.Locale.set(:id_id)
:ok
iex> NeoFaker.Person.first_name() # uses :id_id for this process
"Jaka"
iex> NeoFaker.Person.first_name(locale: :en_us) # overrides per call
"José"See the available locales for the full list of supported locale codes.
Summary
Functions
Seeds the random number generator for the calling process, for reproducible output.
Starts the NeoFaker application and ensures a locale is configured.
Functions
Seeds the random number generator for the calling process, for reproducible output.
NeoFaker draws values via Enum.random/1 and :rand.uniform/1, both backed by :rand, which
OTP already seeds automatically and unpredictably per process. Call this at the start of a
test (or anywhere else you need deterministic fake data) to pin that seed instead.
Examples
iex> NeoFaker.seed(12_345)
:ok
iex> NeoFaker.seed({1, 2, 3})
:ok
@spec start() :: :ok
Starts the NeoFaker application and ensures a locale is configured.
If no locale is set in the application environment, it defaults to :default.
Prints the active locale to stdout and returns :ok.
Examples
iex> NeoFaker.start()
:ok