# Digits of Pi

• Are there patterns?
• If not, is it suitable for random number generation?

# Method

import matplotlib.pyplot as pltimport numpy as npwith open('pi.txt') as f:    read_data = f.read()#       0  1  2  3  4  5  6  7  8  9data = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]objects = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']for c in read_data:    if c in objects: data[int(c)] += 1y_pos = np.arange(len(objects))plt.bar(y_pos, data)plt.xticks(y_pos, objects)plt.xlabel('Digit')plt.ylabel('Instances')plt.title('Digits of the first 1M of $\pi$')plt.show()

# Conclusion

--

--

--

## More from Patrick Brown

Software Engineer. 70% of my body is made of code.

Love podcasts or audiobooks? Learn on the go with our new app.

## Patrick Brown

Software Engineer. 70% of my body is made of code.