Skip to main content

True Random Number Generator

This node generates true random numbers using system entropy.

The TRNG node provides the highest quality randomness available on the system.

The True Random Number Generator (TRNG) node uses the underlying system's cryptographic random number generator (e.g., window.crypto in browsers or crypto module in Node.js). Unlike pseudorandom generators (PRNGs) like Math.random or ISAAC, TRNGs rely on unpredictable system events (entropy) and cannot be seeded or reproduced.

Inputs

Actions

SignalDescription
DoGenerates the next random number.

Outputs

Data

DataDescription
Generated ValueThe generated random number.

Signals

SignalDescription
DoneTriggered when the value has been generated.

Usage

Use this node when unpredictability is critical and reproducibility is not desired.

Example Use Cases

  1. Security: Generating session IDs, nonces, or cryptographic keys.
  2. Gambling/Gaming: Determining outcomes where fairness and unpredictability are legally or mechanically required.
  3. Lotteries: Selecting winners.

Detailed Behavior

  1. Non-Deterministic: You cannot seed this node. Every run will produce different results.
  2. Source:
    • Browser: Uses window.crypto.getRandomValues().
    • Server: Uses Node.js crypto.randomBytes().
    • Fallback: If neither is available (rare), falls back to Math.random().

Troubleshooting

  • Cannot Reproduce: By design, you cannot reproduce the sequence. If you need replayability (e.g., for a "seed" in a game), use the ISAAC RNG node instead.