import numpy as np
import matplotlib.pyplot as plt
fig = plt.figure()
ax1 = fig.add_subplot(2, 1, 1)
ax2 = fig.add_subplot(2, 1, 2)
mean1=[]
mean2=[]
tempVal=0.0
rng = np.random.default_rng()
x=rng.standard_normal(500)*0.1+50
for j in range(100):
  for i in range(5):
    tempVal=tempVal+x[5*j+i]
  tempVal=tempVal/5.
  mean1.append(tempVal)
  tempVal=0.0
# second histgram has two times better deviation
x2=rng.standard_normal(2000)*0.1+50
for j in range(100):
  for i in range(20):
    tempVal=tempVal+x2[20*j+i]
  tempVal=tempVal/20.
  mean2.append(tempVal)
  tempVal=0.0
ax1.hist(mean1,bins=20,range=(49.9,50.1))
ax2.hist(mean2,bins=20,range=(49.9,50.1))
plt.show()