Note
Go to the end to download the full example code.
Shamrock Gaussian generator#
This example shows how to use the mock gaussian function
10 import shamrock
Use shamrock documentation style for matplotlib
14 shamrock.matplotlib.set_shamrock_mpl_style()
19 eng = shamrock.algs.gen_seed(111)
20
21 import matplotlib.pyplot as plt
22 import numpy as np
23
24 hist, bins = np.histogram(
25 [shamrock.algs.mock_gaussian(eng) for _ in range(100000)], bins=1000, density=True
26 )
27 x = np.linspace(bins[0], bins[-1], 1000)
28 plt.plot(x, np.exp(-(x**2) / 2) / np.sqrt(2 * np.pi), "r--", lw=2)
29 plt.bar(bins[:-1], hist, np.diff(bins), alpha=0.5)
30 plt.show()

Total running time of the script: (0 minutes 0.872 seconds)
Estimated memory usage: 159 MB