# What is the correct way to choose the start parameters for NIST tests? [duplicate]

I had an idea of creating a pseudo-random binary sequence with that code:

import random as rd
p=[]
k=10**6
for i in range(k):
p.append(rd.getrandbits(1))

s=''
for i in p:
s+=str(i)
a=p.count(0)
b=p.count(1)
f = open('s.txt', 'w')
f.write(s)
f.close()


And on the stage of testing it with NIST tests there came a question of choosing right parameters for launching them. If I set the length of the sequence for this file for 100000 and number of bitstreams for 1, will it mean that from this file i will have only first 100000 bits tested as one sequence? Should the data in file be separated in some way?

I have also checked this question on crypto.stackexchange, but to be honest it didn't help me. Reading the official docs for NIST package didn't bring no understanding of bitstreams parameter too.

I will be very grateful if you explain me, how to set number of bitstreams parameter correctly and explain the meaning of it in this situation and the way the input data should be given to the tests.

• What are you hoping to do by running the NIST tests? We know a priori that Python's random module does not make a good PRNG, because it uses the Mersenne twister, but the NIST tests won't tell you that—the NIST tests were written without knowledge of how Python's random module works. – Squeamish Ossifrage Oct 28 '19 at 21:31

So an input file should be at least 1MB in size. A good rule of thumb is 1 Byte * (no of bits for testing). But you won't get any meaningful P values for RandomExcursions and RandomExcursionsVariant until you go to a 10MB input as in ./assess 1000000. However, these two excursion tests don't generate P values until the input is >100MB.
• @RGeorgy Yes I think I'd concur. It's no secret that I'm a harsh critic of NIST randomness code, but I have a feeling in my water that these tests are not exactly 100% stable/reliable. I seem to remember not getting excursion Ps for 200MB files. Yet in refreshing my memory for this answer, I got Ps with files ~10MB. But I also got a 0/10 for LinearComplexity over /dev/urandom output, and that's very curious as it's very highly improbable... – Paul Uszak Oct 28 '19 at 17:13