-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgrng.py
36 lines (26 loc) · 752 Bytes
/
grng.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from matplotlib import pyplot as plt
import numpy as np
from boxMuller.boxMuller import *
from grand.grand import *
from wallace.wallace import *
from ziggurat.ziggurat import *
def plot(list_gauss):
x = np.linspace(-4, 4, 800, endpoint=True)
count = x * 0
for num in list_gauss:
if -4 < num < 4:
index = int((num + 4) // 0.01)
# print (index)
# print (count)
count[index] = count[index] + 1
plt.plot(x, count)
plt.show()
if "__main__" == __name__:
print("this is grng")
grng_ = Wallace(seed=99)
list_gauss = []
for i in range(300):
listTemp = grng_.generate()
for g in listTemp:
list_gauss.append(g)
plot(list_gauss)