Skip to content

Commit 8db4954

Browse files
committed
Created TRNG.py script to produce true random sequence for comparison. TRNG.py created sysTRNG.json as output.
1 parent e0d129b commit 8db4954

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

TRNG.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import random
2+
import json
3+
4+
def writejson(obj,fname):
5+
with open(fname,"w") as f:
6+
json.dump(obj,f)
7+
8+
def sysrandom(len=1000000):
9+
#Using random module
10+
#Making the rng use systemrandom, which is TRNG, not PRNG
11+
rng = random.SystemRandom()
12+
sys = []
13+
for i in range(len):
14+
sys.append(rng.randint(1,26))
15+
return sys
16+
17+
if __name__ == "__main__":
18+
writejson(sysrandom(),"sysTRNG.json")

sysTRNG.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)