randomInt - Generate a pseudorandom integer
randomInt
will create a pseudorandom number between 0
and n
exclusively.
NOTE: randomInt
is not a cryptographically secure source of randomness.
Syntax
Arguments
Name | Type | Required | Description |
---|---|---|---|
upperBound | number | true | The highest value the random number can be, exclusively. |
Example - Basic usage
To create a random number from 0 to 99 and add it as a field named random_num
to a document, one can simple combine randomInt
with the create
command:
Theme
Light