Random Number
A random number between a minimum and a maximum, both included.
Node id math/random-number
The Random Number node outputs a random number from min to max. By
default it is between 0 and 1.
Inputs
| Name | Type | Default | Notes |
|---|---|---|---|
| min | number | 0 | |
| max | number | 1 |
Outputs
| Name | Type | Notes |
|---|---|---|
| result | number |
Behaviour
- Both ends included. The result can be
min,maxor anything in between. Withminequal tomax, it is always that number. - Repeatable. The numbers aren't truly random: they come from a seeded sequence, so the same graph always draws the same picture, and editing another part of the graph doesn't change them. For other values, give the node a new seed (the dice in the inspector, or New random seed in its context menu).
- One number per node. Each Random node has its own sequence (two of them give different numbers), but a single node gives one number to every node it is connected to. For a different number per element, the random node has to be inside the function given to Map, where each call draws its own.
Errors
mingreater thanmax(including NaN for either) is an error.
Related nodes
- Random Integer: a random whole number.
- Random Color: a random color, from the same kind of sequence.
- Lerp: with a random
t, a random point between two values.