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 between min and max, inclusive.
Generates a random first name.
Generates a random full name.
Generates a random full name with optional prefix and/or suffix.
Generates a random gender value.
Generates a random last name.
Generates a random middle name.
Generates a random name prefix such as "Mr.", "Ms.", or "Dr.".
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 between min and max, inclusive.
min defaults to 0 and max defaults to 120.
Examples
iex> NeoFaker.Person.age()
44
iex> NeoFaker.Person.age(7, 44)
27
iex> NeoFaker.Person.age(18, 65)
35
Generates a random first name.
Options
:sex(:unisex,:female, or:male) - the sex of the name. Defaults to:unisex.:locale(atom) - the 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(:unisex,:female, or:male) - the sex of the name. Defaults to:unisex.:locale(atom) - the locale to use. Defaults to the application's configured locale.:middle_name(boolean) - 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(:unisex,:female, or:male) - the sex of the name. Defaults to:unisex.:locale(atom) - the locale to use. Defaults to the application's configured locale.:middle_name(boolean) - whether to include a middle name. Defaults totrue.:prefix(boolean) - whentrue, prepends a name prefix such as"Mr."or"Dr.". Defaults tofalse.:suffix(boolean) - 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 gender value.
Options
:format(:binary,:short_binary,:non_binary, or:all) - which gender representation to return. Defaults to:binary.:binary- the full binary gender, e.g."Male"or"Female".:short_binary- the abbreviated binary gender, e.g."M"or"F".:non_binary- a non-binary gender identity string, e.g."Non-binary".:all- the binary and non-binary identities combined, e.g."Female"or"Genderfluid". The abbreviated:short_binarycodes are left out, since they are just shorthand for the binary values.
:locale(atom) - the locale to use. Defaults to the application's configured locale.
Examples
iex> NeoFaker.Person.gender()
"Male"
iex> NeoFaker.Person.gender(format: :short_binary)
"M"
iex> NeoFaker.Person.gender(format: :non_binary)
"Non-binary"
iex> NeoFaker.Person.gender(format: :all)
"Genderfluid"
iex> NeoFaker.Person.gender(locale: :id_id)
"Perempuan"
Generates a random last name.
Options
:sex(:unisex,:female, or:male) - the sex of the name. Defaults to:unisex.:locale(atom) - the 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(:unisex,:female, or:male) - the sex of the name. Defaults to:unisex.:locale(atom) - the 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 name prefix such as "Mr.", "Ms.", or "Dr.".
Options
:locale(atom) - the 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 name suffix such as "Jr.", "Sr.", or "III".
Options
:locale(atom) - the 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"