python - NIST Randomness Tests requires a sequence of ASCII 0's and 1's but does not accept any trial from MATLAB -
i trying use nist randomness test suite randomness tests of long 0-1 bit sequences. requires me supply either ascii zeroes , ones or binary file each byte 8 bits of data. however, tried
save(...,'-ascii')
, fwrite()
, other commands make work not accept , gives me segmentation error
+ igamc: underflow error.
if can how create matching format in addition if knows mathematica created own sample files below mathematica , maybe can format , can tell me in matlab.
binexp[num_,d_] := module[{n,l}, if[d > $maxprecision, $maxprecision = d]; n = n[num,d]; l = first[realdigits[n,2]] ]; se = binexp[e,302500]; save["data.e",{se}];
i assume have software installed (compiled) instructed in manual
to see how run software start in section 5.3 in manual.
you can generate ascii file of random 0/1 generated in matlab follows:
n=10000; % <-- length of sequence seq = rand(n,1)>0.5; fid=fopen('test.txt','w','native'); fprintf(fid,'%d',seq) fclose(fid)
[hat tip @amro explains alternate binary file format in comments below.]
place file in program source directory , run
> ./assess.exe 10000
or equivalent on system , follow prompts. output in folders within \experiments\algorithmtesting\
you can evaluate program test data in folder \data , compare results listed in appendix b, example here ascii formatted rep of pi in data.pi:
> ./assess.exe 1000000 0 [data source?] .\data\data.pi [path file?] 1 [tests?] 0 [adjust pars?] 1 [bitstreams?] 0 [ascii?]
edit
here (untested) interpretation of amro's explanation of how write string array of 0/1 binary:
fid=fopen('test.txt','w','native'); fwrite(fid, bin2dec(reshape(num2str(a),[],8)), 'uint8') fclose(fid)
Comments
Post a Comment