Functions for generating random address data.
Provides utilities to generate street names, city names, country names, building numbers, and geographic coordinates with support for multiple locales.
Summary
Functions
Generates a random building number within the given range, as a string.
Generates a random city name.
Generates a random {latitude, longitude} coordinate pair.
Generates a random country name.
Generates a random latitude between -90.0 and 90.0.
Generates a random longitude between -180.0 and 180.0.
Functions
Generates a random building number within the given range, as a string.
range defaults to 1..100. Call String.to_integer/1 yourself if you need an integer.
Examples
iex> NeoFaker.Address.building_number()
"42"
iex> NeoFaker.Address.building_number(1..100)
"25"
Generates a random city name.
The city name is selected from locale-specific data. See the available locales for supported codes.
Options
:locale(atom) - the locale to use. Defaults to the application's configured locale.
Examples
iex> NeoFaker.Address.city()
"Saint Marys City"
iex> NeoFaker.Address.city(locale: :id_id)
"Palu"
Generates a random {latitude, longitude} coordinate pair.
For a single component, use latitude/1 or longitude/1.
Options
:precision(non-negative integer) - the number of decimal places. Defaults to6.
Examples
iex> NeoFaker.Address.coordinate()
{11.5831672, 165.3662683}
iex> NeoFaker.Address.coordinate(precision: 2)
{11.58, 165.37}
Generates a random country name.
The country name is selected from locale-specific data. See the available locales for supported codes.
Options
:locale(atom) - the locale to use. Defaults to the application's configured locale.
Examples
iex> NeoFaker.Address.country()
"United States"
iex> NeoFaker.Address.country(locale: :id_id)
"Amerika Serikat"
Generates a random latitude between -90.0 and 90.0.
Options
:precision(non-negative integer) - the number of decimal places. Defaults to6.
Examples
iex> NeoFaker.Address.latitude()
11.5831672
iex> NeoFaker.Address.latitude(precision: 4)
11.5832
Generates a random longitude between -180.0 and 180.0.
Options
:precision(non-negative integer) - the number of decimal places. Defaults to6.
Examples
iex> NeoFaker.Address.longitude()
165.3662683
iex> NeoFaker.Address.longitude(precision: 4)
165.3663