Im just messing around in python since im learning at the moment.
Im checking the NIST randomness beacon, and im parsing for the output, removing all letters and using it as a seed to generate random numbers, I append those to an array and save the array to a file but Im getting an error.
import numpy as np
import array as arr
import random
import urllib.request
import urllib.parse
import re
url = 'https://beacon.nist.gov/beacon/2.0/pulse/last'
f = urllib.request.urlopen(url)
data_set = str(f.read().decode('utf-8'))
#print(data_set)
#print(subStr)
#print(type(subStr))
subStr = data_set
subStr = re.findall(r'"outputValue" : "(.+?)"',data_set)
print(subStr)
print(type(subStr))
subStr = ''.join(subStr)
print(type(subStr))
NIST_SEED = ''.join(filter(str.isdigit, subStr))
print(NIST_SEED)
NIST_SEED = float(NIST_SEED)
numbers = arr.array('d', [])
#print(numbers)
i = 0
for i in range(10):
# randon_number = random.random()
random_number = random.seed(NIST_SEED)
numbers.extend([random_number])
print(numbers)
np.savetxt('data.out', numbers)
Im getting this error, I don't understand why im getting this since the "seed" is a float. Im trying to understand the error.
File "generating_data.py", line 38, in <module>
numbers.extend([random_number])
TypeError: must be real number, not NoneType
EDIT:
Im an absolute newbie in python and I have no idea about software development. Im just writing stuff to test things out and to understand concepts. The idea behind this was to try a few different things out and to write a script that is generating CPU load so that I can learn about multithreading or example. This might be a stupid way to do it and It might not even teach me anything idk yet.