Get Random Boolean Array

Get an array of randomized boolean values (true or false).

CategoryRandom
AuthorPol Gubau
Since1.0.4
Last Updated2025-03-17
TypeSync
CompatibilityUniversal

Example

  • Input

    getRandomBooleanArray(3)

    Output:

    [true, false, true]

Return

A random boolean value.

Type: boolean

Props

NameTypeDefaultRequiredDescription
lengthnumbernullYesThe length of the array to generate.

Notes

The probability of true and false is 50% each, you need to specify the length.

Tags

  • random
  • boolean
  • array

Related