random between

This block is part of the number group and was last modified in core v10.4.28.

random between v10.4.28

Generates a random number between, including, the given two numbers. This number will be an integer (e.g. 1, 2, 3) without decimals.

In pins 2
  • min required
    number
  • max required
    number
Out pins 3
  • number
    number
  • success
    condition
  • error
    value

Outputs a cryptographically secure random integer between number_0 (min) and number_1 (max), both bounds inclusive, with condition=true. Both bounds must be valid integers (numeric strings and booleans coerce): an invalid or non-integer bound outputs number=nil, condition=false, and an error message on the value pin, and max <= min outputs number=0 with condition=false. Example: number_0=1 number_1=6 -> one of 1,2,3,4,5,6.

A typical wiring for random between: number feeds the number_0 pin; number feeds the number_1 pin; the number out pin feeds substring.

Studio canvas example for the random between block: typical wiring for random between.

Commonly used with

In production blueprints, this block is most often wired together with:

  • number: feeds into this block. Generates a valid number from the filled custom value in the blueprint.
  • substring: this block feeds into it.
  • set fields: this block feeds into it. Generates an array of mutations based on the given filled fields.
  • get at index: this block feeds into it. Returns the element stored at the given zero-based index. An index outside the array, or an element that is null, outputs null.
  • cast to value: this block feeds into it. Converts the given number into a value.

Version history

Introduced in v10.4.28.


Back to number Return to the main group to view all sub-groups Back to number Return to the group to view all blocks within this group