Python program demonstrating law of large numbers for dice rolls.

# ? 2019 TheFlyingKeyboard and released under MIT License # theflyingkeyboard.net import numpy as np from matplotlib import pyplot as plt from pylab import rcParams rolls = np.random.randint(1, 7, 100000) data = [] for i in range(rolls.size): data.append(rolls[:i + 1].mean()) rcParams['figure.figsize'] = 16, 9 plt.gca().yaxis.grid(True) plt.xlabel("Rolls") plt.ylabel("Mean") plt.plot(data) plt.show()