Normal


Reading time: about 2 minutes
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>

The following pages link here

Citation

If you find this work useful, please cite it as:
@article{yaltirakliwikinormal,
  title   = "Normal",
  author  = "Yaltirakli, Gokberk",
  journal = "gkbrk.com",
  year    = "2024",
  url     = "https://www.gkbrk.com/wiki/normal/"
}
Not using BibTeX? Click here for more citation styles.
IEEE Citation
Gokberk Yaltirakli, "Normal", December, 2024. [Online]. Available: https://www.gkbrk.com/wiki/normal/. [Accessed Dec. 17, 2024].
APA Style
Yaltirakli, G. (2024, December 17). Normal. https://www.gkbrk.com/wiki/normal/
Bluebook Style
Gokberk Yaltirakli, Normal, GKBRK.COM (Dec. 17, 2024), https://www.gkbrk.com/wiki/normal/

Comments

© 2024 Gokberk Yaltirakli