Apidog Docs
🇺🇸 English
  • 🇺🇸 English
  • 🇯🇵 日本語
  • 🇪🇸 Español
  • 🇰🇷 한국인
  • 🇨🇳 简体中文
  • 🇵🇹 Português (Portugal)
  • 🇮🇩 Bahasa Indonesia
  • 🇧🇷 Português (Brasil)
  • 🇻🇳 Tiếng Việt
  • 🇨🇳 繁體中文
🇺🇸 English
  • 🇺🇸 English
  • 🇯🇵 日本語
  • 🇪🇸 Español
  • 🇰🇷 한국인
  • 🇨🇳 简体中文
  • 🇵🇹 Português (Portugal)
  • 🇮🇩 Bahasa Indonesia
  • 🇧🇷 Português (Brasil)
  • 🇻🇳 Tiếng Việt
  • 🇨🇳 繁體中文
🇺🇸 English
  • 🇺🇸 English
  • 🇯🇵 日本語
  • 🇪🇸 Español
  • 🇰🇷 한국인
  • 🇨🇳 简体中文
  • 🇵🇹 Português (Portugal)
  • 🇮🇩 Bahasa Indonesia
  • 🇧🇷 Português (Brasil)
  • 🇻🇳 Tiếng Việt
  • 🇨🇳 繁體中文
HomeLearning Center
Support CenterAPI ReferencesDownloadChangelog
HomeLearning Center
Support CenterAPI ReferencesDownloadChangelog
  1. Learning Center
  • Back to home
  • Dynamic Values Modules
  • Airline
  • Animal
  • Color
  • Commerce
  • Company
  • Database
  • Datatype
  • Date
  • Finance
  • Food
  • Git
  • Hacker
  • Helpers
  • Image
  • Internet
  • Location
  • Lorem
  • Music
  • Number
  • Person
  • Phone
  • Science
  • String
  • System
  • Vehicle
  • Word
  1. Learning Center

Datatype

Module to generate boolean values.

Module Overview#

For a simple random true or false value, use boolean().

boolean#

Returns the boolean value true or false.
Note: A probability of 0.75 results in true being returned 75% of the calls; likewise 0.3 => 30%. If the probability is <= 0.0, it will always return false. If the probability is >= 1.0, it will always return true. The probability is limited to two decimal places.
Parameters
NameTypeDefaultDescription
probabilitynumber0.5The probability ([0.00, 1.00]) of returning true.
Returns: boolean
Examples
NOTE
The function faker.datatype.boolean(0.9) used a positional argument 0.9 to specify the probability of returning True.
This has been updated to use a named parameter probability. The equivalent function call is now {{ $datatype.boolean(probability=0.9) }}.
Modified at 2026-01-14 09:10:00
Previous
Database
Next
Date
Built with