*This article is an extract from my book “Synthetic Data and Generative AI”, available here.*

There are very few serious articles in the literature dealing with digits of irrational numbers to build a pseudo-random number generator (PRNG). It seems that this idea was abandoned long ago due to the computational complexity and the misconception that such PRNG’s are deterministic while others are not. Actually, my new algorithm is less deterministic than congruential PRNGs currently used in all applications. New developments made this concept of using irrational numbers, worth revisiting. It believe that my quadratic irrational PRNG debunks all the myths previously associated to such methods.

Thanks to new developments in number theory, quadratic irrational PRNGs — the name attached to the technique presented here — are not only just as fast as standard generators, but they also offer a higher level of randomness. Thus, they represent a serious alternative in data encryption, heavy simulation or synthetic data generation, when you need billions or trillions of truly random-like numbers. In particular, a version of my algorithm computes hundreds (or millions) of digits for billions of irrational numbers at once. It combines these digits to produce large data sets of strong random numbers, with well-known properties. The fast algorithm can easily be implemented in a distributed architecture, making it even faster. It is also highly portable and great to use when exact replicability is critical: standard generators may not lead to the same results depending on which programming language or which version of Python you use, even if your seed is static.

With quadratic irrationals, the “seed” (initial conditions) is actually a sequence of bivariate parameters. It is similar to regular re-seeding in standard generators. When seeds are hardware-generated, it leads to random numbers fit for strong encryption. This new PRNG was built after designing advanced tests of randomness that identified flaws in popular PRNGs used in many applications, including the Mersenne twister — once thought unbreakable. The Mersenne twister is the default random number generator in Python. Of course, unlike most other generators, quadratic irrational PRNG’s all have an infinite period. However, this is not their main selling point. The previous randomness tests in question include the new prime test discussed in this article.

I produced two sets of 1.5 million digits: one with the quadratic irrational PRNG, and one with the Mersenne twister. You can perform various tests on this dataset, and compare the results from both methods. Of course, using my Python code, you can produce as many digits as you want, play with the parameters and try any seed sequence that you want. I plan on sharing a data set with more than one trillion digits in the near future.

*Get the full 5-page article (PDF) with Python code and all the details, on my GitHub repository, here. For free, no sign-up required. *