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
| Signal | Description |
|---|---|
| Do | Generates the next random number. |
Outputs
Data
| Data | Description |
|---|---|
| Generated Value | The generated random number. |
Signals
| Signal | Description |
|---|---|
| Done | Triggered when the value has been generated. |
Usage
Use this node when unpredictability is critical and reproducibility is not desired.
Example Use Cases
- Security: Generating session IDs, nonces, or cryptographic keys.
- Gambling/Gaming: Determining outcomes where fairness and unpredictability are legally or mechanically required.
- Lotteries: Selecting winners.
Detailed Behavior
- Non-Deterministic: You cannot seed this node. Every run will produce different results.
- Source:
- Browser: Uses
window.crypto.getRandomValues(). - Server: Uses Node.js
crypto.randomBytes(). - Fallback: If neither is available (rare), falls back to
Math.random().
- Browser: Uses
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.