# How to distinguish quantum random from classical random?

Given two sets of $$N$$ uniformly random binary bitstrings of size $$m$$, such as $$(x_0,x_1,...,x_m) \space \forall x_i \in \{0,1\}.$$

One generated from a quantum device and the other generated by random uniform in Python. Knowing that quantum is really random and classical is pseudo-random, is there any statistical test to distinguish which one is classical and which one quantum?

• besides a statistical test to check which is classical which is quantum, how are you even generating quantum random numbers in python? – develarist Nov 16 '19 at 11:51
• What about application Hadamards on n qbit and then measure then? – Martin Vesely Nov 16 '19 at 13:20

Depends on what pseudorandom generator Python is using; if the pseudorandom generator is cryptographically secure, then it is computationally impossible to distinguish whether a bit string is generated by the pseudorandom generator or is truly random.

On the other hand, "truly random" quantum generator may fail classical randomness tests, because real-world quantum random number generation does not automatically guaranty uniformity (and requires some randomness extractor, quantum or classical, to make the output bit string computationally indistinguishable from uniform).

The idea behind pseudo-random number generators is to generate random numbers using the software, which is convenient and cost-effective. The pseudo-random number generators are one-way functions so if you know the seed you can predict their subsequent values but you cannot determine the sequence of values if you do not know the seed. Quantum randomness is physical randomness or the so-called true randomness. Mathematically, they both have the same statistical properties; provided large number of values are sampled from both of them. Thus, a well designed pseudo-random number generator would be as random as Physical (True) Quantum random number generators, so if you do not know the seed, you will not be able to distinguish them. The advantage of Physical (True) Quantum random number generators is that you cannot guess their values in any case.

If the pseudo-random number generator is not well designed then you can identify patterns in it like the infamous RANDU routine (https://en.wikipedia.org/wiki/Randomness_tests), which fails randomness tests.

In practice, physical source of randomness is often XORed with pseudo-random numbers to pass the randomness test. You may refer to https://en.wikipedia.org/wiki/Random_number_generation

In general, you cannot distinguish between the two. Both classical and quantum mechanics can produce arbitrary probability distributions, so there simply isn't enough information to distinguish between the two if that's all you have access to.

A setting in which observable differences can be observed is when locality is taken into account. If the probability distribution is obtained by spatially separated parties interacting with two parts of an entangled system, then the produced correlations in the observed statistics can be measurably incompatible with classical mechanics (see Bell's inequalities and such).

• Then may I ask, what is the fuss around "quantum random generator"? – user185597 Nov 26 '19 at 14:35
• @user185597 well, the idea is that with QM, with an ideal setup, the numbers are genuinely random, in the sense that one can even sometimes prove that it's not possible to predict the outcomes in any way (then again, noise and imperfections might hinder this). A classical computer can instead only run algorithms to generate pseudo random numbers, which are in principle predictable given enough information. So both might generate an overall random distribution of numbers, but in one case there might in principle be a way to predict the next numbers from the previously drawn ones. – glS Nov 26 '19 at 14:42
• Note that there are many caveats to consider. For example, many classical computers use purpose hardware to generate randomness from environmental noise and such rather than using only deterministic algorithms generating pseudo randomness. – glS Nov 26 '19 at 14:43