I've recently tried to build a Random generator using 5 hadamard gates (shown as U2 below) measured to 5 classical bits in parallel as shown in the circuit image. Simple circuit

I've executed this circuit for 8192 shots (and repeated this many times) hoping to get somehow flat histogram of every of 32 possible states. Yet, instead i've found that probability decreases in almost linear fassion from |00000> -> |11111> which is bizare. I'm very new to quantum computing - could someone explain me why there is visible such strong linear dependence? Or maybe this is expected, but why?

What I tried up til now:

  • I've tried to change measurment order and using/not using barrier before measurements. Everything was calculated on ibmq_burlington mashine.
  • I've also tried error mitigation (CompleteMeasFitter prepared and applied to results, with no luck - as before I can see a strong linear relation).


Can anybody help me to understand this behaviour?

Regards Konrad

  • $\begingroup$ Why aren't you using the default Hadamard gates? $\endgroup$
    – C. Kang
    Jul 14, 2020 at 18:13
  • $\begingroup$ Well, I am. This figure is copied from IBM Quantum experience website and it always shows H gates like this. In my qiskit Jupyter notebook it shows as normal H gate. For absolute clarity, this is how I make my circuit in qiskit: circuit.h(0) circuit.h(1) circuit.h(2) circuit.h(3) circuit.h(4) circuit.barrier() circuit.measure([4,3,2,1,0], [4,3,2,1,0]) $\endgroup$
    – Konrad
    Jul 14, 2020 at 18:22
  • $\begingroup$ Well, it seems that ibmq_essex is working as expected using the same circuit, I've tried also ibmq_london and effect is similar to burlington. May be this conected with qbit topology on those mashines ? $\endgroup$
    – Konrad
    Jul 14, 2020 at 18:50
  • $\begingroup$ Yes, based on Qiskit's documentation, $U2(0,\pi) = H$ (qiskit.org/documentation/stubs/…) Are you getting the same results on a simulator? I ran the same experiment in the simulator and could not reproduce your results $\endgroup$ Jul 14, 2020 at 18:50
  • $\begingroup$ I've checked and ibmq_qasm_simulator runing the same circuit shows "flat" histogram, as expected. $\endgroup$
    – Konrad
    Jul 14, 2020 at 18:55

1 Answer 1


The issue is that you are using noisy hardware with imperfect operations and measurements. In particular, the most likely problem here is that after you prepare a qubit it immediately begins decaying towards the ground state $|0\rangle$ via interactions with the environment. Each qubit will be slightly more likely to be measured as 0 instead of 1 than you'd expect from a noiseless machine. Try grouping by the number of 1s in the result and the effect will stand out even more.

It's difficult to say for sure exactly what is going wrong. For example, given only this circuit you can't really tell if the errors are occurring during state preparation, measurement, or intermediate operations. Also, my understanding is that IBM may be modifying your circuits before executing them (e.g. inserting random bitflips to depolarize errors, or purposefully adding a bit of noise to see which results go up and then extrapolating backwards) which makes it particularly hard to assign blame to any one part of the circuit.

  • $\begingroup$ Your answer sounds very logical. The more "ones" in the outcoming measurements, the less probable the state is. This also explains this 'linear' phenomena. Neverthless, I'm very surprised to see this, especially when considering that |00000> state is almost 4-times more preferable than |11111> state (~6% vs 1.5%). The real question therefore becomes: How to realize trully random generator on such quantum computer? For now, I will try to use the essex mashine, which seems more robust to this noise/decoherence. $\endgroup$
    – Konrad
    Jul 14, 2020 at 19:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.