Get Random Boolean Array
Get an array of randomized boolean values (true or false).
| Category | Random |
| Author | Pol Gubau |
| Since | 1.0.4 |
| Last Updated | 2025-03-17 |
| Type | Sync |
| Compatibility | Universal |
Example
Input
getRandomBooleanArray(3)Output:
[true, false, true]
Return
A random boolean value.
Type: boolean
Props
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| length | number | null | Yes | The 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