100 000 Pi (π) decimals vs. random numbers

I have previously written a post about how I decided to visualize 100k decimals of Pi, Tau and e with Python. To do that I chose a simple set of three rules that was repeated for each decimal digit; For each of the decimals:

  1. First, draw a tiny square and fill it with a color preselected for each of the ten digits 0-9.
  2. Then move in forward the same length as one side of the square multiplied with the decimal digit itself.
  3. Last, turn 90 degrees counter-clockwise multiplied with the decimal digit.

These rules could have been anything, bit following them for 100 000 decimals of π, it ended up looking like this:

Now, how would this compare to a set of 100 000 totally random digits?

Python uses the Mersenne Twister as the core generator. It produces 53-bit precision floats and has a period of 2**19937-1. The underlying implementation in C is both fast and threadsafe. The Mersenne Twister is one of the most extensively tested random number generators in existence. [1]

By using Python’s random.randint() in a quick script [2]:


I ran the script three times. Each time a new visually representation of the digits found its way out in an artsy way:

Does that tell me anything about the decimals of π? Would you look at the as a fourth “random” sequence of digits?

The digits of the decimal expansion of π are not a random sequence. They are a specific sequence generated by a very short algorithm. At best, they could form a random-like sequence in the sense that they satisfy various statistical smoothness properties. It is, in fact, widely believed (but not proven) that this sequence contains every finite string infinitely many times. In particular, it is believed that the sequence contains appropriate encodings of every known text, image or movie, including all false, wrong, and misrepresented versions of such content. [3]


[1] https://docs.python.org/3.1/library/random.html
[2] https://gist.github.com/orjanv/9ca4858cc57649e1ec4646bf510e12a5
[3] https://www.quora.com/How-random-are-the-digits-in-pi