In [1]:
get_ipython().ast_node_interactivity = 'all'
import os
import matplotlib.pyplot as plt
import numpy as np
import random
np.set_printoptions(suppress=True)
In [2]:
targetDev = 1

def fitness():
    vals = np.array([random.gauss(0, targetDev) for _ in range(2 ** 20)])
    hist = np.histogram(vals, bins=100)[1]
    plt.plot(hist)

fitness()
Out:
<Figure size 640x480 with 1 Axes>
In [3]:
bruh = lambda m, s, n: np.sqrt(n) * sum([m + np.random.uniform(-s, s) for _ in range(n)]) / n

_ = plt.hist([bruh(0, 1, 25) for _ in range(2**14)], bins=50)
Out:
<Figure size 640x480 with 1 Axes>
In [4]:
_ = plt.hist([np.random.normal(0, 1) for _ in range(2**14)], bins=50)
Out:
<Figure size 640x480 with 1 Axes>