I'm researching the quantum random number service offered by the computer maker Quantinuum. They say that they have verified quantum randomness by a Bell test. I took Bell's 1964 classic paper and coded up the corresponding circuit. The circuit prepares a singlet Bell state, rotates by 45 degrees about the x axis in the Bloch sphere and performs a measurement. Adding one to the correlation (mean spin product) gives the left hand side of Bell's equation 15 for the angles he specifies in the discussion following equation 22. I repeated the circuit and took the absolute value of the correlation, giving the right-hand side of equation 15. The inequality is violated, implying that there is quantum randomness and that there is no hidden variable. If a simulator can pass the Bell test, what does it prove that Quantinuum's product passes the Bell test? Furthermore, the numbers aren't truly random - they are derived from a seed. So shouldn't they fail the Bell test?

(15) $$1+P(b,c)\ge|P(a,b)-P(a,c)|$$

from make_bell import *
def initialize(qc):
    qc = make_bell_nc(1,1,0,1,qc) #singlet
    theta = np.pi/4
    return qc
q = QuantumRegister(2)
c = ClassicalRegister(2)
qc = QuantumCircuit(q,c)
qc = initialize(qc)
for i_qubit in range(2):
# IBMQ.save_account("")
for irun in range(2):
    if simulate==0: #Live back end
        backend_name = config['BACKENDS']['live']
        provider = IBMQ.get_provider(hub='ibm-q', group='open', project='main')
        backend = provider.get_backend(backend_name)

    elif simulate == 1:
        if compute_state:
            backend_name = 'statevector_simulator'
            from qiskit.providers.aer import QasmSimulator
            backend = QasmSimulator()  #    Use Aer's qasm_simulator
            backend_name = 'qasm_simulator'
    if simulate==1:
        result = execute(qc, backend=backend,shots=shots).result()
    elif simulate==0: #Live back end
        compiled_circuit = transpile(qc, backend)
        job = backend.run(compiled_circuit, shots=20000)
        result = job.result()
print(f'correlations {pbc:.2f} {pab:.2f}')
lhs = 1+pbc
rhs = np.abs(pab)
print(f"lhs {lhs:.3f} rhs {rhs:.3f} {lhs>=rhs}")

The left-hand side was about .3 $$1-1/\sqrt{2}$$ and the right-hand side was about .7 $$1/\sqrt{2}$$

  • 5
    $\begingroup$ If it simulates the laws of quantum physics, of course it will pass the test. But likely, your simulator will not separate the two particles it measures in a way where they cannot exchange information any more. $\endgroup$ Commented May 24, 2023 at 17:11
  • $\begingroup$ If you're considering actually using this service, I recommend asking about it at the Cryptography SE. I'm pretty sure they'll tell you not to use it, because even if Quantinuum is honest, it's very easy to screw up the implementation. Modern x64 and ARM CPUs have built-in quantum RNGs that are safer. $\endgroup$
    – benrg
    Commented May 24, 2023 at 19:26

1 Answer 1


In order for Bell's theorem to apply, you need to factor your code into two pieces (an Alice piece and a Bob piece) that can run on separate computers with no messages being passed during the part of the game where the players are supposed to be separated.

The code you have implemented can't be executed on two separated computers because the state vector inside the simulator doesn't split into Alice and Bob parts. So in this case your non-local hidden variable is the state_vector: np.ndarray field inside the simulator plus the state of the pseudo-random number generator being used to sample the state vector.


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.