Back to the workbench
✓ Shipped 1 min read

Quantum Random Number Generator

Truly random numbers from a quantum circuit: n qubits put into superposition with Hadamard gates using IBM Qiskit.

Logged
Links
Spec sheet
Framework
IBM Qiskit
Circuit
n qubits, each through a Hadamard gate
Output
Truly random numbers

Overview

This is a quantum random number generator I created using IBM Qiskit. It generates a truly random number by leveraging a quantum circuit with n qubits, each initialized into a superposition state using Hadamard gates.

How it works

  • Build a circuit with n qubits.
  • Apply a Hadamard gate to each one, putting it in an equal superposition of 0 and 1.
  • Measure every qubit. Each collapses to 0 or 1 with genuinely random outcome.
  • Read the measured bits as an n-bit random number.

Terminal output from the script: a fresh random number straight from the circuit.

Talk shop about this build

Questions, corrections, or "why didn't you just…" — all welcome.