Skip to content

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

QRNG ANU — Quantum Random Numbers for TouchDesigner

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.


What it does

  • 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) and randfloat() helpers
  • Runs in a background thread — zero impact on TD's cook loop

Requirements

  • TouchDesigner 2022+ (tested on 2023.11600)
  • Python 3.9+ (bundled with TD)
  • An ANU API key — free at quantumnumbers.anu.edu.au
  • Internet connection

Installation

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 value
  • qrng_table — Table DAT with rolling history (hex + normalized float)
  • qrng_chop — Script CHOP exposing a normalized float channel qrng

Usage

Drive any parameter

Connect qrng_chop's output channel directly to any TD parameter via a Math CHOP to remap the 0.0–1.0 range.

Call from Python

# 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 values

Start / Stop the stream

op('QRNG_ANU/qrng_script').start()
op('QRNG_ANU/qrng_script').stop()

Configuration

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.


Why quantum randomness?

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

API source

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.


License

MIT — free to use, modify, and distribute.


Contributing

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)

About

TouchDesigner module streaming true quantum random numbers from the ANU Quantum Random Numbers Server. Sources entropy from quantum vacuum fluctuations — not pseudo-random, not atmospheric. Drives any TD parameter via CHOP, DAT, or Python. Free ANU API key required.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages