-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
85 lines (63 loc) · 2.07 KB
/
test.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
'''This File is used for testing Randomness in the algorithms
and for plotting the findings of those tests.'''
from Algorithms.RandomMarsenne import Random
from Algorithms.RandomWells import WellsRandom
from Algorithms.RandomBBS import RandomBBS
from Algorithms.RandomBMAlgo import RandomBM
import matplotlib.pyplot as plt
from collections import Counter
from PIL import Image
from IPython.display import display
import random
# %matplotlib inline
test = Random()
# num_trials = 10**7
# s = [test.randint(0,1001) for n in range(num_trials)]
# y = [s.count(n) for n in range(1000)]
# # your code here
# plt.bar(range(1000),y, width=1.0, edgecolor='black')
# plt.title('My MT algorithm')
# plt.ylabel("Times of show up")
# plt.xlabel('Outcome')
# plt.show()
# num_trials = 10**7
# random.seed()
# s = [random.randint(0,1000) for n in range(num_trials)]
# y = [s.count(n) for n in range(1000)]
# # your code here
# plt.bar(range(1000),y, width=1.0, edgecolor='black')
# plt.title('Python buit-in Random')
# plt.ylabel("Times of show up")
# plt.xlabel('Outcome')
# plt.show()
"""THIS IS THE CODE FOR THE IMAGE"""
# IMAGE_SIZE = 500
# myImg = Image.new('RGB', (IMAGE_SIZE,IMAGE_SIZE), "white")
# pixels = myImg.load()
# test = Random()
# for i in range(50000):
# x = test.randint(0,IMAGE_SIZE)
# y = test.randint(0,IMAGE_SIZE)
# # print(str(x)+", "+str(y)+"\n")
# pixels[x,y] = (0,0,0)
# myImg.save("RANDOMSEEDWITHTIME50000.png","PNG")
"""THIS IS THE CODE TO TEST THE
WELLS ALGO"""
# test = WellsRandom()
# test.InitWELLRNG512a()
# print(test.WELLRNG512a())
# print(test.WELLRNG512a())
# print(test.WELLRNG512a())
# rand = Random()
# print(rand.randint(0,600))
# print(rand.randint(0,600))
# print(rand.randint(0,600))
"""Code To Test Blum-Blum Shub"""
# tester = RandomBBS(19,23,6)
# print(tester.getRandBit())
# print(tester.getRandBit())
# print(tester.getRandBit())
# print(tester.getRandBit())
"""Code to test the Blum-Micali"""
# tester = RandomBM()
# print(tester.getRandBits(256))