# How to create a perfect random number generator from an imperfect device?

One way to generate random numbers is from a laser source and a semi-reflective mirror.

This semi-reflector can be some crystal, prepared and calibrated so that the probability of a photon passing is 50%, equal to the chance of being reflected. If the upper detector captures the photon, the value will be 0, and if the lower detector captures, 1.

However, in practice it is extremely difficult to prepare the crystal so that the probability is exactly 50%. Let’s say that there is an imperfection, and this chance is 51% of passing, and 49% of being reflected.

How to create a perfect random number generator from this imperfect device?

Assign 0 or 1 if the sequence of results alternates.
D1 D2 -> 0
D2 D1 -> 1

There is an equal chance of D1D2 and D2D1, compensating for the imperfection

If both give equal results, we discard the result and redo the experiment:

Based on a chapter in the book “Explorations in Quantum Computating — Colin Williams”.

Mach-Zender interferometer:

https://informacaoquantica.wordpress.com/2020/08/18/o-interferometro-de-mach-zender/

Technical ideas with a bit of philosophy

https://ideiasesquecida.com/

Join the Quantum Computing study group:

## More from Arnaldo Gunzi

Project Manager on Analytics and Innovation. “Samurai of Analytics”. Passionate about Combinatorial Optimization, Philosophy and Quantum Computing.