-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
55 lines (47 loc) · 1.62 KB
/
main.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
import quantumrandom
import random
print("==============================================")
print("Quantum number generator")
print("==============================================")
print("Getting quantum data from (https://qrng.anu.edu.au)...")
print("----------------------------------------------")
data = quantumrandom.get_data()
number = data[0]
random.seed(number)
options = {
0: "Random number",
1: "Random number from a range"
}
print("==============================================")
print("Which type of random number would you like?")
print("----------------------------------------------")
for x in options:
print(str(x) + ") " + options[x])
print("==============================================")
type = None
while not isinstance(type, int):
type = input ("[" + " / ".join(str(x) for x in options.keys()) + "]: ")
if type.isdigit() and int(type) in options.keys():
type = int(type)
else:
print("Error: input must be an integer from the options listed")
if type == 0:
output = random.random()
elif type == 1:
start = None
while not isinstance(start, int):
start = input ("Whats the start of the range? ")
if(start.isdigit()):
start = int(start)
else:
print("Error: input must be an integer")
end = None
while not isinstance(end, int):
end = input ("Whats the end of the range? ")
if(end.isdigit()):
end = int(end)
else:
print("Error: input must be an integer")
output = random.randint(start, end)
print("==============================================")
print("Output: " + str(output))