Overview
The Random Number Block, also known as RNG, generates a random number within a specified range. This block is useful for creating randomized behavior in your flow. The block can be configured to generate either integers or floating-point numbers. The range of the random number can be specified with a minimum and maximum value. The maximum value can be set to be either inclusive or exclusive.- Inputs
- Outputs
- Editor Settings
Inputs
| Title | Data Type | Description | Default Value | Notes |
|---|---|---|---|---|
| Min | number | The minimum value of the random number. This input is only available if Use Min Input is enabled in the editor settings. | (optional) | The input will be coerced into a number if it is not a number. |
| Max | number | The maximum value of the random number. This input is only available if Use Max Input is enabled in the editor settings. | (optional) | The input will be coerced into a number if it is not a number. |
Example 1: Generate a random integer
- Create a Random Number Block.
- Set the
Minto1and theMaxto10. - Enable the
Integerssetting. - Run the flow. The output of the Random Number Block should be a random integer between 1 and 10.
Example 2: Generate a random floating-point number
- Create a Random Number Block.
- Set the
Minto0and theMaxto1. - Disable the
Integerssetting. - Run the flow. The output of the Random Number Block should be a random floating-point number between 0 and 1.
Error Handling
The Random Number Block will error if theMin is greater than the Max. If the Min and Max are equal, the block will always output the Min value.
FAQ
Q: Can I use the Random Number Block to generate a random boolean value? A: Yes, you can use the Random Number Block to generate a random boolean value by setting theMin to 0, the Max to 1, and enabling the Integers setting. The block will then output either 0 or 1, which can be interpreted as false and true by a Bool Block.
Q: Can I use the Random Number Block to generate a random string?
A: No, the Random Number Block can only generate random numbers. If you want to generate a random string, you can use a Code Block with a custom JavaScript function.

