A uniform distribution assigns equal probability to every outcome in a given set. It is the mathematical model of a fair coin and supports random-number generation, simulation inputs, and modeling. In a quantum state, equal probabilities require amplitudes with equal magnitudes. section 3.4.1 section 4.1.2
Quantum circuits encode the distribution through these reusable patterns:
- For one qubit, apply H, RY(π/2), or RX(π/2) to the initial state; the resulting equal amplitudes produce equal outcome probabilities. section 3.4.1
- For multiple qubits, apply a Hadamard gate to every qubit. A three-qubit system then has eight outcomes with equal amplitudes and probabilities. section 4.3.4
- Measure repeatedly to obtain samples. Observed counts approximate the probabilities, while the required number of repetitions depends on confidence, problem type, and error rates. section 3.4.1 section 4.1.2
Three-qubit uniform state
Initialize three qubits and apply H to each. The state amplitudes become eight equal values, approximately 0.353553 each, so measurement samples the eight computational-basis outcomes uniformly. section 4.3.4 section 4.5.3
Listing 4.11 Encoding the uniform distribution in a quantum state
def uniform(n):
q = QuantumRegister(n)
qc = QuantumCircuit(q)
for i in range(len(q)):
qc.h(q[i])
return qc
The reusable uniform(n) function constructs a quantum register and applies a Hadamard gate to every qubit. section 4.5.3








