NeoFaker.Person (neo_faker v0.7.1)
View SourceProvides functions for generating person-related information.
This module offers a variety of functions to generate random personal details, such as names, ages, and genders.
Summary
Functions
Generates a random age.
Generates a random binary gender.
Generates a random first name.
Generates a random full name.
Generates a random last name.
Generates a random middle name.
Generates a random non-binary gender.
Generates a random name prefix.
Generates a random short binary gender.
Generates a random name suffix.
Functions
@spec age(non_neg_integer(), non_neg_integer()) :: non_neg_integer()
Generates a random age.
The age is a non-negative integer between 0
and 120
by default.
Examples
iex> NeoFaker.Person.age()
44
iex> NeoFaker.Person.age(7..44)
27
Generates a random binary gender.
Returns either "Male"
or "Female"
.
Examples
iex> NeoFaker.Person.binary_gender()
"Male"
Generates a random first name.
If no options are provided, it returns a random unisex first name.
Options
The accepted options are:
:type
- Specifies the type of name to generate.:locale
- Specifies the locale to use.
Values for option :type
can be:
nil
- Generates a random unisex name (default).:male
- Generates a random male name.:female
- Generates a random female name.
Values for option :locale
can be:
nil
- Uses the default locale"default"
."id_id"
- Uses the Indonesian locale, for example.
Examples
iex> NeoFaker.Person.first_name()
"Julia"
iex> NeoFaker.Person.first_name(type: :male)
"José"
iex> NeoFaker.Person.first_name(locale: "id_id")
"Jaka"
Generates a random full name.
If no options are provided, it returns a default random unisex full name.
Options
The accepted options are:
:locale
- Specifies the locale to use.:sex
- Specifies the sex of the generated name.:middle_name
- Determines whether to include a middle name in the full name.
Values for option :locale
can be:
nil
- Uses the default locale"default"
."id_id"
- Uses the Indonesian locale, for example.
Values for option :sex
can be:
nil
- Generates a random unisex name (default).:male
- Generates a random male name.:female
- Generates a random female name.
Values for option :middle_name
can be:
true
- Includes a random middle name (default).false
- Excludes the middle name.
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"
Generates a random last name.
This function behaves similarly to first_name/1
. See first_name/1
for available options.
Generates a random middle name.
This function behaves similarly to first_name/1
. See first_name/1
for available options.
Generates a random non-binary gender.
Returns a non-binary gender, such as "Agender"
, "Androgyne"
, "Bigender"
, etc.
Examples
iex> NeoFaker.Person.non_binary_gender()
"Agender"
Generates a random name prefix.
Examples
iex> NeoFaker.Person.prefix()
"Mr."
Generates a random short binary gender.
Returns either "M"
or "F"
.
Examples
iex> NeoFaker.Person.short_binary_gender()
"F"
Generates a random name suffix.
Examples
iex> NeoFaker.Person.suffix()
"IV"