Home » Uncategorized

One Trillion Random Digits

You will find here a few tables of random digits, used for simulation purposes and/or testing or integration in statistical, mathematical, and machine learning algorithms. These tables are particularly useful if you want to share your algorithms or simulations, and make them replicable. We also provide techniques to use in applications where secrecy is critical, such as cryptography, bitcoin or lotteries: in this case, you don’t want to share your table of random numbers; to the contrary you want it to be secret and impossible to reverse-engineer. 


Let’s start with the largest table: one trillion digits, which takes 50 hours to download. You need to make sure you have enough disk space to store it. It consists of the first trillion digits of Pi, and it has passed all existing tests of randomness. To this date, no pattern has ever been found in that sequence. The table can be found here. Details about how these digits were computed can be found here and here.


An excellent book focusing on this problem is Mathematics by Experiment, written by Jonathan Borwein and David Bailey. Another book with a different, original perspective, is my book entitled Applied Stochastic Processes, Chaos Modeling, and Probabilistic Properties of Numeration Systems, available here

Another approach for random number generation is to use the Mersenne twister. Its period is 2^19937 – 1. Or you may check out this website. Note that the digits of Pi do not have a period; in short, the period is infinite. Random digits based on physical phenomena have biases due to measurement errors, though these biases are so small that they do not matter.

More accessible tables of random digits

The following can easily be downloaded using the links below.

  • 10 million digits of SQRT(2) in base 10. These are just as random of the digits of Pi. No formal proof of this fact exists; the most recent material on this topic is published here and here. You can download these digits here
  • 1 million digits of SQRT(2) in base 2. You can download these digits here.

I have performed some statistical analyses on these digits, see here. Simple formulas to compute these digits exist, see for instance here (read the last sentence in that article.) Testing whether digits are random or not, is further investigated in my free book, particularly in chapter 13. More can be found here

Internet tools such as WolframAlpha can be used if you only need a small table. In particular, my 1 million digits table was produced interactively using SageMath.org. Instructions on how to do it are provided here.  For more interactive calculators (for statisticians), check out this website

Random digits for strong encryption

This topic is discussed at length in my free book published in June 2018. I still continue to work on this, and recently came up with some original concept, described below. You may use a numeration base that is not an integer to increase security, as described in my book, but even with a standard integer base such as binary or decimal digits, the following can be very useful.

Instead of considering the digits a(n) of a real number as being indexed by integers, consider extending the concept to values of n that are real numbers themselves. Then you use digits of Pi in positions that are not integers, say digits of Pi in positions SQRT(2), SQRT(3), and so on, rather than digits of Pi in positions number 1, 2, and so on. This is done as follows: 


Here x is the number we are interested in (say x = Pi), b is the base, and a(n) is the n-th digit of x in base b. It corresponds to standard digits if n is an integer (assuming b is an integer), and non-standard digits if n is a real number, not an integer. The above formula, easy to prove, comes from Chapter 10 in my book

Another context in which random digits (that can not be guessed), are required, is with lotteries. It is illustrated in this article.  

For related articles from the same author, click here or visit www.VincentGranville.com. Follow me on on LinkedIn, or visit my old web page here.

DSC Resources

Leave a Reply

Your email address will not be published. Required fields are marked *