Project: A Quantum Random Number
A single Hadamard on one qubit gives one random bit. What if you need more? The answer is straightforward: use independent qubits, apply a Hadamard to each, and measure all of them. The result is an -bit quantum random number whose bits are genuinely independent and uniformly distributed.
From one random bit to many
After a Hadamard, qubit sits in the equal superposition
Applying this to each of the qubits independently produces the product state
where the sum runs over every -bit string . This is the uniform superposition over all computational basis states. Measuring it collapses the state to one of those strings, each with probability
For qubits, there are possible outcomes and each carries probability .
Why the bits are independent
The product state above has no entanglement: qubit 0 does not know the result of qubit 1. Formally, the state factors as a tensor product, meaning the joint probabilities factorize too — with each marginal equal to . Each qubit contributes exactly one independent, unbiased random bit.
Try it
Build the 4-qubit circuit that generates a 4-bit quantum random number. The grader checks that every one of the 16 outcomes has equal probability .
After running, open the Probabilities panel. You should see 16 equal bars, each at height . Because the bits are independent, you can read the 4-bit result as an integer from 0 to 15, drawn uniformly at random by the laws of quantum mechanics.
Sign in on the full site to ask questions and join the discussion.