A TouchDesigner module that streams true quantum random numbers from the ANU Quantum Random Numbers Server directly into your TD network.
Unlike pseudo-random generators (random, noise, os.urandom), this module sources entropy from quantum vacuum fluctuations measured at the Australian National University — making it the only source of genuine physical randomness available in TouchDesigner.
- Streams live hex values from the ANU QRNG API
- Exposes normalized float values (0.0–1.0) ready to drive any TD parameter
- Maintains a rolling history table (configurable depth)
- Provides
randint(min, max)andrandfloat()helpers - Runs in a background thread — zero impact on TD's cook loop
- TouchDesigner 2022+ (tested on 2023.11600)
- Python 3.9+ (bundled with TD)
- An ANU API key — free at quantumnumbers.anu.edu.au
- Internet connection
1. Set your API key as an environment variable
On Mac/Linux, add to your ~/.zshrc or ~/.bashrc:
export ANU_API_KEY="your_key_here"On Windows:
setx ANU_API_KEY "your_key_here"
2. Import the module into TouchDesigner
Drag QRNG_ANU.tox into your network. Press the Start button in the Custom parameters panel.
3. Connect operators
Inside the module you'll find:
qrng_output— Text DAT with the latest hex valueqrng_table— Table DAT with rolling history (hex + normalized float)qrng_chop— Script CHOP exposing a normalized float channelqrng
Connect qrng_chop's output channel directly to any TD parameter via a Math CHOP to remap the 0.0–1.0 range.
# From any Script DAT or Execute DAT
script = op('QRNG_ANU/qrng_script')
# Latest hex string
print(script.latest()) # e.g. "a3f1"
# Normalized float 0.0–1.0
print(script.latest_float()) # e.g. 0.638472
# Quantum integer in range
print(script.randint(0, 180)) # e.g. 112
# Full history
print(script.history()) # list of last 100 hex valuesop('QRNG_ANU/qrng_script').start()
op('QRNG_ANU/qrng_script').stop()Inside qrng_script_dat.py:
| Parameter | Default | Description |
|---|---|---|
INTERVAL |
0.5 |
Seconds between API calls |
BATCH_SIZE |
10 |
Values fetched per request |
MAX_HISTORY |
100 |
Rolling history depth |
Reduce INTERVAL carefully — the ANU API has rate limits on free tier accounts.
Standard TD noise functions (Noise CHOP, random()) are deterministic — given the same seed, they produce identical sequences. Cryptographic RNGs (os.urandom) are computationally unpredictable but not physically random.
This module uses entropy sourced from quantum vacuum fluctuations — a process that is fundamentally non-deterministic at the physical level, making it useful for:
- Generative systems where true unpredictability matters
- Live performance where repetition must be impossible
- Research and artistic practice exploring randomness as medium
Data is fetched from the ANU Quantum Random Numbers Server, operated by the Department of Quantum Science at The Australian National University. The entropy is generated by measuring the quantum fluctuations of a vacuum field using a homodyne detection scheme.
MIT — free to use, modify, and distribute.
PRs welcome. Possible directions:
- OSC output to bridge with other software
- Multiple API source support (ID Quantique, Quantinuum)
- Visualization components
- Integration examples (generative art, servo control, random draw)