Answer the question
In order to leave comments, you need to log in
Why doesn't python random number generator pass NIST tests?
#!/usr/bin/env python3
import random
while True:
s = ""
for i in range(0, 500):
s = s + str(random.randint(0, 1))
print(s)
input()
Answer the question
In order to leave comments, you need to log in
The random module computes random numbers using the Mersenne Twister algorithm ... Functions in random() should not be used in programs related to cryptography. If you need such functionality, consider using functions in the ssl module instead. For example, ssl.RAND_bytes() can be used to generate a cryptographically secure sequence of random bytes.
The built-in random never passes NIST tests. For the needs of cryptography, other sources of entropy are needed, for example, the secrets module .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question