Skip to main content

ISAAC Random Number Generator

This node generates cryptographically secure pseudorandom numbers using the ISAAC algorithm.

The ISAAC RNG node provides high-quality random numbers suitable for simulation and cryptography.

The ISAAC Random Number Generator node uses the ISAAC (Indirection, Shift, Accumulate, Add, and Count) algorithm to produce high-quality random numbers. Unlike standard Math.random(), ISAAC is cryptographically secure and can be seeded for deterministic reproducibility.

Inputs

Configuration

DataDescription
SeedA number to seed the generator. If provided, the sequence of random numbers will be deterministic (same seed = same sequence).
NonceAn additional number to mix into the state. Useful for varying the sequence even with the same seed.

Actions

SignalDescription
DoGenerates the next random number in the sequence.

Outputs

Data

DataDescription
Generated ValueThe generated random number (float between 0 and 1, scaled to internal max).

Signals

SignalDescription
DoneTriggered when the value has been generated.

Usage

Use this node when you need high-quality randomness or reproducible random sequences (e.g., for procedural generation or replay systems).

Example Use Cases

  1. Procedural Generation: Generate a game world. Using a specific Seed allows players to share world seeds.
  2. Simulation: Run deterministic simulations where you need to repeat the exact same random events for debugging.
  3. Cryptography: Generating secure tokens or keys (though specialized nodes are often better for this).

Detailed Behavior

  1. Seeding:
    • If Seed is provided, the generator initializes with that state.
    • Changing the Seed or Nonce resets the generator.
    • If no seed is provided, it uses Date.now() and Math.random() for entropy.
  2. Algorithm:
    • ISAAC is designed to be fast (avg 18.75 instructions per 32-bit value) and secure (cycle length 2^8295).
    • It produces uniformly distributed results.

Troubleshooting

  • Same Value Repeated: If you are setting the Seed immediately before every "Do", you might be resetting the generator constantly. Set the Seed once, then trigger "Do" multiple times to get the sequence.