So I wrote a short Python function to plot distribution outcome of dice experiments. It\'s working fine but when I run for example dice(1,5000)
or dice(10
If you are lazy (like me), you can also use numpy to directly generate a matrix and seaborn to deal with bins for you:
import numpy as np
import seaborn as sns
dices = 1000
throws = 5000
x = np.random.randint(6, size=(dices, throws)) + 1
sns.distplot(x)
Which gives:
Seaborn usually make good choices, which can save a bit of time in configuration. That's worth a try at least. You can also use the kde=False
option on the seaborn plot to get rid of the density estimate.
Just for the sake of it and to show how seaborn behave, the same with the sum over 100 dices:
dices = 100
throws = 5000
x = np.random.randint(6, size=(dices, throws)) + 1
sns.distplot(x.sum(axis=0), kde=False)