Skip to main content

Random Number

Created 19 Mar 2026·Updated 31 Jul 2026

Generate a cryptographically secure random number between a minimum and maximum value. The result is stored and can be referenced in any following action using placeholder syntax - making it perfect for randomized delays, dynamic overlay text, variable increments, and more.

What You Need​

  • Nothing extra - this action works standalone.

Quick Start​

  1. Create or edit an alert.
  2. Click Add Action and select Random Number.
  3. Set your Minimum and Maximum values.
  4. Note the action's key (e.g. random_number_1) shown in the action header - you'll use this to reference the result.
  5. In any later action, type {{ random_number_1.result }} wherever you want to use the number.
  6. Save and test.

Configuration Options​

Range​

SettingDescriptionDefault
MinimumThe lower bound of the range (inclusive).1
MaximumThe upper bound of the range (inclusive).100
  • Both Minimum and Maximum support placeholder syntax - you can use event data (e.g. {{ amount }}) to set the range dynamically.
  • For integers: both bounds are inclusive (e.g. a range of 1–6 can produce 1, 2, 3, 4, 5, or 6).
  • Minimum must be less than or equal to Maximum, or the action will fail with an error.

Float Mode​

SettingDescriptionDefault
Float ModeWhen enabled, generates a decimal number instead of a whole integer.Off
Decimal PrecisionNumber of decimal places in the result (0–10). Only visible when Float Mode is on.2
  • Integer mode (default): uses a cryptographically secure integer generator. Both bounds inclusive.
  • Float mode: generates a cryptographically secure decimal. For example, with a range of 1.0–2.0 and precision 2, you might get 1.47.
  • Decimal Precision supports placeholder syntax.

Using the Result in Other Actions​

When a Random Number action runs, its output is stored under the action's key and made available to all subsequent actions via placeholders.

PlaceholderValue
{{ random_number_1.result }}The generated number
{{ random_number_1.min }}The minimum bound that was used
{{ random_number_1.max }}The maximum bound that was used
{{ random_number_1.float_mode }}true or false
{{ random_number_1.precision }}The precision setting (float mode only)

The key (random_number_1, random_number_2, etc.) is shown in the action's header inside the alert editor. If you have multiple Random Number actions, each gets its own numbered key.


Example Use Cases​

Randomized Delay​

Add a Random Number action (range 1000–5000), then a Delay action set to {{ random_number_1.result }} ms. The pipeline will pause for a random amount of time between 1 and 5 seconds.

Dynamic Overlay Text​

In a Stream Overlay action's text field, type:

"You rolled a {{ random_number_1.result }}!"

Variable Increment​

In a Global Variable action set to Add, use {{ random_number_1.result }} as the value to add a random amount to a counter.

Random Intensity​

Feed the result into a PiShock or OpenShock intensity field to randomize shock/vibration strength.


Tips​

  • Place Random Number early in your action list - its result is only available to actions that come after it.
  • Integer mode is best for dice rolls, counts, and anything where whole numbers matter.
  • Float mode is best for percentages, probabilities, or when you want finer granularity.
  • The generator is cryptographically secure - it uses Node.js's crypto module, so results are truly unpredictable and not affected by a predictable seed.