Skip to main content

Random Number Node

The Random Number Node generates a random integer within a range of your choosing.

Random Number Node

Configuration

The node takes three parameters, all of which are required.

Minimum Value Template and Maximum Value Template are each a number or a string template resolving to a numerical value on your payload. The randomly generated number is inclusive of the defined minimum and maximum values; for example, if 0 is set as the minimum value, then 0 is a possible output from the node.

The Result Path is a payload path stipulating where on the payload the resulting number should be stored.

Node Failure Cases

If the node cannot generate a random number (for example, when the minimum or maximum value is not a number, or when the minimum value is greater than the maximum value), the result stored on the payload at the result path will be NaN. The workflow continues; the node does not halt or trigger an error path. Some cases where this occurs:

  • The minimum or maximum value is not a number. The node attempts to type the value to a number (for example, a string of "1" will type to the number 1), but if that fails, the result will be NaN.
  • The minimum value is greater than the maximum value. No valid random number can exist in that range.
  • There are no integers between the minimum and maximum values. For example, if a minimum value of 1.3 and a maximum value of 1.9 are passed, the result will be NaN because there is no integer between the two values.

Was this page helpful?


Still looking for help? You can also search the Losant Forums or submit your question there.