Random Integer
A random whole number between a minimum and a maximum, both included.
Node id math/random-integer
The Random Integer node outputs a random whole number from min to max,
each equally likely. By default it is 0 or 1.
Inputs
| Name | Type | Default | Notes |
|---|---|---|---|
| min | number | 0 | |
| max | number | 1 |
Outputs
| Name | Type | Notes |
|---|---|---|
| result | number |
Behaviour
- Both ends included. With
min= 1 andmax= 6, it is like a die: 1, 2, 3, 4, 5 or 6. - Fractional limits are rounded inwards:
min= 0.5 andmax= 3.5 give 1, 2 or 3. - Repeatable. As with Random Number, the numbers come from a seeded sequence: the same graph always draws the same picture, and each node has its own sequence. For other values, give the node a new seed (the dice in the inspector, or New random seed in its context menu).
Errors
mingreater thanmax(including NaN for either) is an error.- So is a range with no whole number in it, such as 0.2 to 0.8.
Related nodes
- Random Number: any number in a range.
- Get: with a random index, a random element of an array.