umontreal-simul / TestU01-2009

This is the 2009 version of TestU01, a software library, implemented in the ANSI C language, and offering a collection of utilities for the empirical statistical testing of uniform random number generators.
Apache License 2.0
64 stars 17 forks source link

How to run bbattery_BigCrush test function using binary txt file as input #23

Closed bavlayan closed 1 year ago

bavlayan commented 1 year ago

Hi, We want to run bbattery_BigCrush function. Instead of giving generator as an input, we want to give binary file as input to test. However, we have encountered an error. How we can overcome this error?

#include <stdio.h>
#include "gdef.h"
#include "swrite.h"
#include "bbattery.h"

int main (int argc, char *argv[])
{
   if (argc != 2) {
       printf("Specify binary file of random bits as ./test <path>");
       return 0;
   }

   FILE* fp = fopen(argv[1], "r");
   fseek(fp, 0L, SEEK_END);
   size_t sz = ftell(fp);
   fclose(fp);

   printf("Reading binary file %s of size %d bits", argv[1], sz);

   bbattery_BigCrush(argv[1]);
   return 0;
}
VictorInpher commented 1 year ago

You can make a generator from a file. Look at page 86 of the doc.