Basic
This is a basic module, it contains integer, float, string, boolean, and date types.
Boolean
dunna.basic.boolean()
returns a random boolean value.
Parameter | Type | Description | Default |
---|---|---|---|
likelihood | number | The likelihood of the output being true | 50 |
Integer
dunna.basic.integer()
returns a random integer between 0 (not inclusive) and 10 (inclusive)
Parameter | Type | Description | Default |
---|---|---|---|
min | number | The minimum value of the output (inclusive) | 0 |
max | number | The maximum value of the output (not inclusive) | 10 |
Float
dunna.basic.float()
returns a random float number between 0 (inclusive) and 10 (not inclusive)
Parameter | Type | Description | Default |
---|---|---|---|
min | number | The minimum value of the output (inclusive) | 0 |
max | number | The maximum value of the output (not inclusive) | 10 |
fixed | number | The number of decimal places | 3 |
Letter
dunna.basic.letter()
returns a random uppercase or lowercase letter
Parameter | Type | Description | Default |
---|---|---|---|
casing | string | The casing of the output letter (upper/lower/any) | “any” |
Choice
dunna.basic.choice(array)
returns a random element from an array
Parameter | Type | Description | Default |
---|---|---|---|
array | T[] | The array to be randomly selected | null |
Pick
dunna.basic.pick(count, array)
returns a random subset of the given array with the given count
Parameter | Type | Description | Default |
---|---|---|---|
count | number | The number of elements to be picked | null |
array | T[] | The array to be randomly selected | null |
Omit
dunna.basic.omit(count, array)
returns a random subset of the given array by omitting elements based on the given count
Parameter | Type | Description | Default |
---|---|---|---|
count | number | The number of elements to be omitted | null |
array | T[] | The array to be randomly selected | null |