# `NeoFaker.Address`
[🔗](https://github.com/muzhawir/neo_faker/blob/main/lib/neo_faker/address.ex#L1)

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.

# `building_number`
*since 0.12.0* 

```elixir
@spec building_number(
  Range.t(),
  keyword()
) :: integer() | String.t()
```

Generates a random building number within a specified range.

Returns the building number as a string by default, or as an integer when
`type: :integer` is passed.

## Parameters

- `range` - The range of building numbers. Defaults to `1..100`.
- `opts` - Keyword list of options:
  - `:type` - Return type. Either `:string` (default) or `:integer`.

## Examples

    iex> NeoFaker.Address.building_number()
    "42"

    iex> NeoFaker.Address.building_number(1..100, type: :integer)
    25

# `city`
*since 0.12.0* 

```elixir
@spec city(Keyword.t()) :: String.t()
```

Generates a random city name.

The city name is selected from locale-specific data. Pass `locale:` to use a
different locale. See the
[available locales](https://hexdocs.pm/neo_faker/locales.html)
for supported codes.

## Examples

    iex> NeoFaker.Address.city()
    "Saint Marys City"

    iex> NeoFaker.Address.city(locale: :id_id)
    "Palu"

# `coordinate`
*since 0.12.0* 

```elixir
@spec coordinate(keyword()) :: {float(), float()} | float()
```

Generates random geographic coordinates.

Returns a `{latitude, longitude}` tuple by default. Use the `:type` option to
return a single value, and `:precision` to control decimal places.

## Parameters

- `opts` - Keyword list of options:
  - `:type` - Which coordinate(s) to return. Defaults to `:full`.
  - `:precision` - Number of decimal places. Defaults to `6`.

## Options

The values for `:type` can be:

- `:full` - Returns `{latitude, longitude}` tuple (default).
- `:latitude` - Returns only the latitude as a float.
- `:longitude` - Returns only the longitude as a float.

## Examples

    iex> NeoFaker.Address.coordinate()
    {11.5831672, 165.3662683}

    iex> NeoFaker.Address.coordinate(type: :latitude)
    11.5831672

    iex> NeoFaker.Address.coordinate(type: :longitude)
    165.3662683

    iex> NeoFaker.Address.coordinate(precision: 2)
    {11.58, 165.37}

    iex> NeoFaker.Address.coordinate(type: :latitude, precision: 4)
    11.5832

# `country`
*since 0.12.0* 

```elixir
@spec country(Keyword.t()) :: String.t()
```

Generates a random country name.

The country name is selected from locale-specific data. Pass `locale:` to use a
different locale. See the
[available locales](https://hexdocs.pm/neo_faker/locales.html)
for supported codes.

## Examples

    iex> NeoFaker.Address.country()
    "United States"

    iex> NeoFaker.Address.country(locale: :id_id)
    "Indonesia"

---

*Consult [api-reference.md](api-reference.md) for complete listing*
