terrillmoore / nist-statistical-test-suite Goto Github PK
View Code? Open in Web Editor NEWThe code from NIST SP-800-22 for testing random-number generators, along with docs for reference
License: Other
The code from NIST SP-800-22 for testing random-number generators, along with docs for reference
License: Other
Hi,
I noticed there is one failure in your sample report, but it's not supposed to be there for data/data.pi? maybe a wrong parameter configuration?
10 0 0 0 0 0 0 0 0 0 0.000000 * 0/10 * Universal
A little setup is needed to build on Ubuntu; let's add a script.
why LinearComplexity test so slow,is there any way to optimize
I'm doing README.md.
I have a trouble for "Sample run for known input".
./assess 100000
Enter Choice : 0
User Prescribed Input File: data/data.pi
Enter Choice: 1
Select Test (0 to continue): 0
After Select Test (0 to continue): 0, I get the following error:
ERROR: LOG FILES COULD NOT BE OPENED.
MAX # OF OPENED FILES HAS BEEN REACHED = 0
-OR- THE OUTPUT DIRECTORY DOES NOT EXIST.
My environment is
OS : Ubuntu20.04 on wsl2 on windows10 Pro
Could you help me?
It's not clear in the docs, and I always forget; others have asked as well.
Hello. I think there is some kind of error during applying 2.6.8 Example.
According to 2.6.8 Example, Page 36 of NIST SP800-22 Revision 1a.
epsilon = "1100100100001111110110101010001000100001011010001100001000110100110001001100011001100010100010111000"
in C form
double X[] = {1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, 1, -1, -1, -1};
n = 100
in Paper, N_1 = 46 (correct answer)
However this source code gave me N_1 = 48 not 46.
(And also, In my implementation, N_1 = 48 seems to correct)
I checked that DFT(this code used Fast Fourier Transform but whatever.) function is correct. (with cross-check source code, matlab, my implementation of page 69 DFT equation, online Discrete Fourier Transform (DFT) Calculator).
Please tell me what is error? Paper's example is wrong? or source code is wrong?
the only thing I doubt is "the actual observed number of peaks" in 2.6.4 Test Description (6)
In this code, it doesn't look count peaks as statistical definition.
below is my code that for testing DFT, almost same as ./sts/src/discreteFourierTransform.c
int main() {
double p_value, upperBound, percentile, N_l, N_o, d, *m = NULL, *wsave = NULL;
int i, count, ifac[15];
int n = 100;
wsave = (double *)calloc(2*n,sizeof(double));
m = (double*)calloc(n/2+1, sizeof(double));
double X[] = {1, 1, -1, -1, 1, -1, -1, 1, -1, -1, -1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, 1, -1, -1, -1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, 1, 1, -1, -1, -1, 1, -1, 1, -1, -1, -1, 1, -1, 1, 1, 1, -1, -1, -1};
__ogg_fdrffti(n, wsave, ifac); /* INITIALIZE WORK ARRAYS */
__ogg_fdrfftf(n, X, wsave, ifac); /* APPLY FORWARD FFT */
m[0] = sqrt(X[0]*X[0]); /* COMPUTE MAGNITUDE */
for ( i=0; i<n/2; i++ )
m[i+1] = sqrt(pow(X[2*i+1],2)+pow(X[2*i+2],2));
count = 0; /* CONFIDENCE INTERVAL */
upperBound = sqrt(2.995732274*n);
for ( i=0; i<n/2; i++ )
if ( m[i] < upperBound )
count++;
percentile = (double)count/(n/2)*100;
N_l = (double) count; /* number of peaks less than h = sqrt(3*n) */
N_o = (double) 0.95*n/2.0;
d = (N_l - N_o)/sqrt(n/4.0*0.95*0.05);
p_value = erfc(fabs(d)/sqrt(2.0));
printf("N_l\t: %lf\n", N_l);
printf("N_o\t: %lf\n", N_o);
printf("d\t: %lf\n", d);
printf("p_value\t: %lf\n", p_value);
// Returns
/*
N_l : 48.000000
N_o : 47.500000
d : 0.458831
p_value : 0.646355
*/
}
Hi,
I'd like to test whether the sequence of data is random (Float32 datatype). Could you please tell me what the NIST test input format should be? In the command ''./assess datastream>'', what should be the value of datastream?
My data looks like this: {1.2,1.3,1.2,1.6,.....}
I took a look at the sample 'data.pi' files, but it was not clear.
Regards,
Nivedita
The document is not part of the source download, and is also offline.
First of all, thank you for your work.
I am facing a problem when I try to run any tests, even the example test you gave on the README. The program gets stuck at line 388 of utilities.c, and then stops the execution.
ERROR: LOG FILES COULD NOT BE OPENED.
MAX # OF OPENED FILES HAS BEEN REACHED = 0
-OR- THE OUTPUT DIRECTORY DOES NOT EXIST.
What could it be?
And also I found the "Out of Bound" Error in for loop which is in line 41~42 ./sts/src/discreteFourierTransform.c
for ( i=0; i < n/2; i++ )
m[i+1] = sqrt(pow(X[2*i+1],2)+pow(X[2*i+2],2));
This line will cause unexpected behavior.
Let's think n = 10
, then maximum i
will be 4. because i < 10/2
2 * i + 2 = 2 * 4 + 2 = 10 then, but, the range of X is [0, 9] So, this is out of bound.
As far as I know, this is out of bound. And also in C, X[n] would be un-initialized value. (It could be dump variable)
Is there any reason that I don't know C grammer?
Originally posted by @TyeolRik in #9 (comment)
Could you help me to explain the question "How many bitstreams?". Because we already initialize the parameter of bitstream length ./assess 100000
.
I don't understand why we have to again initialize the bitstreams
during this process? what does it mean and what for?
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.