diff --git a/Random/BlumBlumShub.png b/Random/BlumBlumShub.png new file mode 100644 index 0000000000000000000000000000000000000000..a76a71b2da75654648425f13b6b7d9e6054c1659 Binary files /dev/null and b/Random/BlumBlumShub.png differ diff --git a/Random/Haynes.png b/Random/Haynes.png new file mode 100644 index 0000000000000000000000000000000000000000..a987085bb68aa984e372d956aa150ea4cdf7a255 Binary files /dev/null and b/Random/Haynes.png differ diff --git a/Random/KnuthLewis.png b/Random/KnuthLewis.png new file mode 100644 index 0000000000000000000000000000000000000000..7fdf9bafa66477e1541c0d57023b49daec8362b9 Binary files /dev/null and b/Random/KnuthLewis.png differ diff --git a/Random/LavauxJenssens.png b/Random/LavauxJenssens.png new file mode 100644 index 0000000000000000000000000000000000000000..24a2c3966ce9d5f98170d05c6b41d4dd4720b04a Binary files /dev/null and b/Random/LavauxJenssens.png differ diff --git a/Random/Marsaglia.png b/Random/Marsaglia.png new file mode 100644 index 0000000000000000000000000000000000000000..68d067382009ba4f5e6a9be61c63811c55bc655e Binary files /dev/null and b/Random/Marsaglia.png differ diff --git a/Random/MersenneTwister.png b/Random/MersenneTwister.png new file mode 100644 index 0000000000000000000000000000000000000000..adb55d1b75bfb1b30f7037ccbea3c5bfa0e2e79e Binary files /dev/null and b/Random/MersenneTwister.png differ diff --git a/Random/MitchelMoore.png b/Random/MitchelMoore.png new file mode 100644 index 0000000000000000000000000000000000000000..5eecf43741f991d8ac40785ac9330803eeb21371 Binary files /dev/null and b/Random/MitchelMoore.png differ diff --git a/Random/ParkMiller.png b/Random/ParkMiller.png new file mode 100644 index 0000000000000000000000000000000000000000..b2405955366bbe82de2ed89e1bb6291bab41bb3c Binary files /dev/null and b/Random/ParkMiller.png differ diff --git a/Random/__pycache__/generators.cpython-311.pyc b/Random/__pycache__/generators.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..e579af00a05d62910d89bae5f79fead178f00e0d Binary files /dev/null and b/Random/__pycache__/generators.cpython-311.pyc differ diff --git a/Random/generators.py b/Random/generators.py index 2d8a444ca88107b4134734a5fee61a5a36971de1..f820e484ff99debe51f8e0e423d2c1152e93dd14 100644 --- a/Random/generators.py +++ b/Random/generators.py @@ -124,7 +124,7 @@ class LaggedFibonnaci(RandomNumberGenerator): return self.values[-1] def randomNorm(self): - return random() / (self.m + 1) + return self.random() / (self.m + 1) class MitchelMoore(LaggedFibonnaci): diff --git a/Random/main.py b/Random/main.py index 3fc897886114252e251d8fca901cb800eb85a8e3..364597cf17d257b33d422cd87d19c8cfed054fe9 100644 --- a/Random/main.py +++ b/Random/main.py @@ -11,13 +11,15 @@ if __name__=="__main__": , MersenneTwister(), BlumBlumShub()] seed = datetime.now().timestamp() - N = 1000 + N = 1000000 RESOLUTION = 100 for e in generators: + name = type(e).__name__ + print("processing "+name+"...") e.seed(seed) res = e.batchRandomNormalized(N) - + print("building histograms..") #matplotlib prep #see https://matplotlib.org/stable/gallery/statistics/histogram_features.html#sphx-glr-gallery-statistics-histogram-features-py fig, ax = plt.subplots() @@ -25,4 +27,5 @@ if __name__=="__main__": ax.set_xlabel('Value') ax.set_ylabel('Probability density') ax.set_title(type(e).__name__) + #plt.show() plt.savefig(type(e).__name__+'.png')