Environment
- Qiskit version: 2.5 (current)
- Python version: 3.13 (but should not matter)
- Operating system: MacOS (but should not matter)
What is happening?
When running the python function random_clifford_circuit from qiskit/circuit/random/utils.py with the same Qiskit version and the same fixed seed, we should get deterministic results.
How can we reproduce the issue?
Run the following python program several times:
from qiskit.circuit.random.utils import random_clifford_circuit
cliff_circuit = random_clifford_circuit(num_qubits=10, num_gates=100, gates="all", seed=0)
print(cliff_circuit.count_ops())
You will see that gate counts (and hence also circuit themselves) change from one run to another.
What should happen?
We should get deterministic results.
Any suggestions?
Taking a brief look at random_clifford_circuit, the seeded numpy random generator should be fine, and the non-determinism probably comes from converting into a set on this line:
gates_1q = list(set(_BASIS_1Q.keys()) - {"v", "w", "id", "iden", "sinv"})
Environment
What is happening?
When running the python function
random_clifford_circuitfromqiskit/circuit/random/utils.pywith the same Qiskit version and the same fixed seed, we should get deterministic results.How can we reproduce the issue?
Run the following python program several times:
You will see that gate counts (and hence also circuit themselves) change from one run to another.
What should happen?
We should get deterministic results.
Any suggestions?
Taking a brief look at
random_clifford_circuit, the seeded numpy random generator should be fine, and the non-determinism probably comes from converting into a set on this line: