Cheat Sheet
View SourceA quick reference for the most commonly used random data generator functions.
App
author(opts \\ [])
iex> NeoFaker.App.author()
"José Valim"
description(opts \\ [])
iex> NeoFaker.App.description()
"Elixir library for generating fake data in tests and development."
license()
iex> NeoFaker.App.license()
"MIT License"
name(opts \\ [])
iex> NeoFaker.App.name()
"Neo Faker"
iex> NeoFaker.App.name(style: :camel_case)
"neoFaker"
semver(opts \\ [])
iex> NeoFaker.App.semver()
"1.2.3"
iex> NeoFaker.App.semver(type: :pre_release)
"1.2.3-beta.1"
version()
iex> NeoFaker.App.version()
"1.2"
Blood
group()
iex> NeoFaker.Blood.group()
"B+"
type()
iex> NeoFaker.Blood.type()
"B"
Boolean
boolean(true_ratio \\ 50, opts \\ [])
iex> NeoFaker.Boolean.boolean()
false
iex> NeoFaker.Boolean.boolean(75)
true
iex> NeoFaker.Boolean.boolean(75, integer: true)
1
Color
cmyk(opts \\ [])
iex> NeoFaker.Color.cmyk()
{0, 25, 50, 100}
iex> NeoFaker.Color.cmyk(format: :w3c)
"cmyk(0%, 25%, 50%, 100%)"
NeoFaker.Color.hsl/1
, NeoFaker.Color.hsla/1
, NeoFaker.Color.rgb/1
and
NeoFaker.Color.rgba/1
behave the same way as NeoFaker.Color.cmyk/1
.
hex(opts \\ [])
iex> NeoFaker.Color.hex()
"#613583"
iex> NeoFaker.Color.hex(format: :three_digit)
"#365"
keyword(opts \\ [])
iex> NeoFaker.Color.keyword()
"blueviolet"
iex> NeoFaker.Color.keyword(category: :basic)
"purple"
Crypto
md5(opts \\ [])
iex> NeoFaker.Crypto.md5()
"e35cb102765cfc56df21ba4c16e6a636"
iex> NeoFaker.Crypto.md5(case: :upper)
"E35CB102765CFC56DF21BA4C16E6A636"
NeoFaker.Crypto.sha1/1
and NeoFaker.Crypto.sha256/1
behave the same way as
NeoFaker.Crypto.md5/1
.
Date
add(range \\ -365..365, opts \\ [])
iex> NeoFaker.Date.add()
~D[2025-03-25]
iex> NeoFaker.Date.add(0..31, format: :iso8601)
"2025-03-25"
between(start \\ ~D[1970-01-01], finish \\ Date.utc_today(), opts \\ [])
iex> NeoFaker.Date.between()
~D[2025-03-25]
iex> NeoFaker.Date.between(~D[2025-03-25], ~D[2025-03-25], format: :iso8601)
"2025-03-25"
birthday(min_age \\ 18, max_age \\ 65, opts \\ [])
iex> NeoFaker.Date.birthday()
~D[1997-01-02]
iex> NeoFaker.Date.birthday(18, 65, format: :iso8601)
"1999-05-06"
Gravatar
display(email \\ nil, opts \\ [])
iex> NeoFaker.Gravatar.display()
"https://gravatar.com/avatar/<hashed_email>?d=identicon&s=80"
iex> NeoFaker.Gravatar.display("john.doe@example.com", fallback: :monsterid)
"https://gravatar.com/avatar/<hashed_email>?d=monsterid&s=80"
Internet
user_agent()
iex> NeoFaker.Internet.user_agent()
"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:72.0) Gecko/20100101 Firefox/72.0"
Lorem
sentence(opts \\ [])
iex> NeoFaker.Lorem.paragraph()
"Suspendisse ac justo venenatis, tincidunt sapien nec, accumsan augue. Vestibulum urna
risus, egestas ut ultrices non, aliquet eget massa. Mauris id diam eget augue sagittis
convallis sit amet nec diam. Morbi ut blandit est, et placerat neque."
iex> NeoFaker.Lorem.paragraph(type: "meditations")
"Do the things external which fall upon thee distract thee? Give thyself time to learn
something new and good, and cease to be whirled around. But then thou must also avoid being
carried about the other way. For those too are triflers who have wearied themselves in life
by their activity, and yet have no object to which to direct every movement, and, in a word,
all their thoughts."
NeoFaker.Lorem.sentence/1
and NeoFaker.Lorem.word/1
behave the same way as
NeoFaker.Lorem.paragraph/1
.
Number
between(min \\ 0, max \\ 100)
iex> NeoFaker.Number.between()
27
iex> NeoFaker.Number.between(1, 100)
28
iex> NeoFaker.Number.between(1.0, 100.0)
29.481745280074264
digit()
iex> NeoFaker.Number.digit()
5
float(left_digit \\ 10..100, right_digit \\ 10000..100_000)
iex> NeoFaker.Number.float()
30.94372
iex> NeoFaker.Number.float(1..9, 10..90)
1.44
Person
age(min \\ 0, max \\ 120)
iex> NeoFaker.Person.age()
44
iex> NeoFaker.Person.age(7, 44)
27
binary_gender()
iex> NeoFaker.Person.binary_gender()
"Male"
first_name(opts \\ [])
iex> NeoFaker.Person.first_name()
"Julia"
iex> NeoFaker.Person.first_name(type: :male)
"José"
NeoFaker.Person.middle_name/1
and NeoFaker.Person.last_name/1
behave the same way as
NeoFaker.Person.first_name/1
.
full_name(opts \\ [])
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"
non_binary_gender(opts \\ [])
iex> NeoFaker.Person.non_binary_gender()
"Agender"
prefix(opts \\ [])
iex> NeoFaker.Person.prefix()
"Mr."
short_binary_gender(opts \\ [])
iex> NeoFaker.Person.short_binary_gender()
"F"
suffix(opts \\ [])
iex> NeoFaker.Person.suffix()
"IV"
Text
character(opts \\ [])
iex> NeoFaker.Text.character()
"a"
iex> NeoFaker.Text.character(type: :digit)
"0"
characters(number \\ 11, opts \\ [])
iex> NeoFaker.Text.characters()
"XfELJU1mRMg"
iex> NeoFaker.Text.characters(20, type: :alphabet_upper)
"BVAJHRGSCEVJFNYSWCJE"
emoji(opts \\ [])
iex> NeoFaker.Text.emoji()
"✨"
iex> NeoFaker.Text.emoji(category: :activities)
"🎉"
word()
iex> NeoFaker.Text.word()
"computer"
Time
add(range \\ -24..24, opts \\ [])
iex> NeoFaker.Time.add()
~T[15:22:10]
iex> NeoFaker.Time.add(-2..2, unit: :minute)
~T[07:23:10]
iex> NeoFaker.Time.add(0..10, format: :iso8601)
"15:22:10"
between(start \\ ~T[00:00:00], finish \\ ~T[23:59:59], opts \\ [])
iex> NeoFaker.Time.between()
~T[15:22:10]
iex> NeoFaker.Time.between(~T[00:00:00], ~T[23:59:59], format: :iso8601)
"15:22:10"