Functions for generating person-related information.
Provides utilities to generate random personal details including first, middle, and last names, full names, prefixes, suffixes, ages, and genders with support for multiple locales and sex options.
Summary
Functions
Generates a random age as a non-negative integer.
Generates a random binary gender.
Generates a random first name.
Generates a random full name.
Generates a random full name with optional prefix and/or suffix.
Generates a random last name.
Generates a random middle name.
Generates a random non-binary gender identity string.
Generates a random name prefix such as "Mr.", "Ms.", or "Dr.".
Generates a random short binary gender such as "M" or "F".
Generates a random name suffix such as "Jr.", "Sr.", or "III".
Functions
@spec age(non_neg_integer(), non_neg_integer()) :: non_neg_integer()
Generates a random age as a non-negative integer.
Parameters
min- Minimum age, inclusive. Defaults to0.max- Maximum age, inclusive. Defaults to120.
Examples
iex> NeoFaker.Person.age()
44
iex> NeoFaker.Person.age(7, 44)
27
iex> NeoFaker.Person.age(18, 65)
35
Generates a random binary gender.
Returns either "Male" or "Female" in the configured locale.
Options
:locale- Locale to use. Defaults to the application's configured locale.
Examples
iex> NeoFaker.Person.binary_gender()
"Male"
iex> NeoFaker.Person.binary_gender(locale: :id_id)
"Perempuan"
Generates a random first name.
Options
:sex- Sex of the name. One of:unisex(default),:female, or:male.:locale- Locale to use. Defaults to the application's configured locale.
Examples
iex> NeoFaker.Person.first_name()
"Julia"
iex> NeoFaker.Person.first_name(sex: :male)
"José"
iex> NeoFaker.Person.first_name(locale: :id_id)
"Jaka"
Generates a random full name.
Combines a first name, an optional middle name, and a last name.
Options
:sex- Sex of the name. One of:unisex(default),:female, or:male.:locale- Locale to use. Defaults to the application's configured locale.:middle_name- Whether to include a middle name. Defaults totrue.
Examples
iex> NeoFaker.Person.full_name()
"Abigail Bethany Crawford"
iex> NeoFaker.Person.full_name(sex: :male)
"Daniel Edward Fisher"
iex> NeoFaker.Person.full_name(middle_name: false)
"Gabriella Harrison"
iex> NeoFaker.Person.full_name(sex: :female, locale: :id_id, middle_name: false)
"Siti Nurhaliza"
Generates a random full name with optional prefix and/or suffix.
Delegates to full_name/1 and wraps the result with the requested title parts.
Options
:sex- Sex of the name. One of:unisex(default),:female, or:male.:locale- Locale to use. Defaults to the application's configured locale.:middle_name- Whether to include a middle name. Defaults totrue.:prefix- Whentrue, prepends a name prefix such as"Mr."or"Dr.". Defaults tofalse.:suffix- Whentrue, appends a name suffix such as"Jr."or"III". Defaults tofalse.
Examples
iex> NeoFaker.Person.full_name_with_title(prefix: true)
"Dr. Abigail Bethany Crawford"
iex> NeoFaker.Person.full_name_with_title(suffix: true)
"Daniel Edward Fisher Jr."
iex> NeoFaker.Person.full_name_with_title(prefix: true, suffix: true, middle_name: false)
"Mr. John Smith III"
Generates a random last name.
Options
:sex- Sex of the name. One of:unisex(default),:female, or:male.:locale- Locale to use. Defaults to the application's configured locale.
Examples
iex> NeoFaker.Person.last_name()
"Smith"
iex> NeoFaker.Person.last_name(sex: :male)
"Johnson"
iex> NeoFaker.Person.last_name(locale: :id_id)
"Wijaya"
Generates a random middle name.
Options
:sex- Sex of the name. One of:unisex(default),:female, or:male.:locale- Locale to use. Defaults to the application's configured locale.
Examples
iex> NeoFaker.Person.middle_name()
"Anne"
iex> NeoFaker.Person.middle_name(sex: :male)
"James"
iex> NeoFaker.Person.middle_name(locale: :id_id)
"Budi"
Generates a random non-binary gender identity string.
Options
:locale- Locale to use. Defaults to the application's configured locale.
Examples
iex> NeoFaker.Person.non_binary_gender()
"Non-binary"
iex> NeoFaker.Person.non_binary_gender(locale: :id_id)
"Non-biner"
Generates a random name prefix such as "Mr.", "Ms.", or "Dr.".
Options
:locale- Locale to use. Defaults to the application's configured locale.
Examples
iex> NeoFaker.Person.prefix()
"Mr."
iex> NeoFaker.Person.prefix(locale: :id_id)
"Tn."
Generates a random short binary gender such as "M" or "F".
Options
:locale- Locale to use. Defaults to the application's configured locale.
Examples
iex> NeoFaker.Person.short_binary_gender()
"M"
iex> NeoFaker.Person.short_binary_gender(locale: :id_id)
"P"
Generates a random name suffix such as "Jr.", "Sr.", or "III".
Options
:locale- Locale to use. Defaults to the application's configured locale.
Examples
iex> NeoFaker.Person.suffix()
"Jr."
iex> NeoFaker.Person.suffix(locale: :id_id)
"S.Kom"
iex> NeoFaker.Person.suffix(locale: :en_us)
"III"