|

This is the API C interface of librandomtest.so. In order to use the API interface you must be aware of: - PARAMETERS AND API CALLS, and - RETURNED ERRORS. Each Random Test API is divided in: - input and output parameters definition, - input and output parameters type definition. - API call.
PARAMETERS AND API CALLS Bit stream to be checked struct bit { unsigned char b:1; /* defines ONE bit */ }; /* BIT FIELD STRUCTURE */
typedef struct bit BitField;
struct inputCheck { BitField* bits; /* Pointer to BitField sequence */ int bitsNumber; /* Number of bits in the 'bits' sequence */ };
typedef struct inputCheck BITS_CHECKED;
Approximate Entropy API struct approximateEntropyParams { double alpha; /* significance level that determines the resgion of acceptance an rejection. NIST recommends that ALPHA be in the range [0,001, 0,01]. */ int m; };
struct approximateEntropyOutput { int random; /* Random result, 0 => NON RANDOM, 1 => RANDOM) */ double p_value; /* The probability that a perfect RNG would have produced a sequence less random than the sequence tested */ double testTime; /* Test execution time */ int seqLength; double chi_squared; double phi; double phiPlusOne; double apen; int blockSizeExceeded; /* Block size greater than */ int blockSizeRecommended; /* int error; /* Error produced in the test, checked it if 'random = 0' */ };
typedef struct approximateEntropyParams APEN_PARAMS; typedef struct approximateEntropyOutput APEN_OUTPUT;
int approximateEntropy(BITS_CHECKED *, APEN_PARAMS *, APEN_OUTPUT *); Frequency API struct frequencyParams { double alpha; /* significance level that determines the resgion of acceptance an rejection. NIST recommends that ALPHA be in the range [0,001, 0,01]. */ };
struct frequencyOutput { int random; /* Random result, 0 => NON RANDOM, 1 => RANDOM) */ double p_value; /* The probability that a perfect RNG would have produced a sequence less random than the sequence tested */ double testTime; /* Test execution time */ int sum; double S_n_div_n; int error; /* Error produced in the test, checked it if 'random = 0' */ };
typedef struct frequencyParams FREQ_PARAMS; typedef struct frequencyOutput FREQ_OUTPUT;
int frequency(BITS_CHECKED *, FREQ_PARAMS *, FREQ_OUTPUT *);
Linear Complexity API struct linearComplexityParams { double alpha; /* significance level that determines the resgion of acceptance an rejection. NIST recommends that ALPHA be in the range [0,001, 0,01]. */ int M; };
struct linearComplexityOutput { int random; /* Random result, 0 => NON RANDOM, 1 => RANDOM) */ double p_value; /* The probability that a perfect RNG would have produced a sequence less random than the sequence tested */ double testTime; /* Test execution time */ double nu[7]; double chi2; int bitsDiscarded; int K; int N; int error; /* Error produced in the test, checked it if 'random = 0' */ };
typedef struct linearComplexityParams LINCOMP_PARAMS; typedef struct linearComplexityOutput LINCOMP_OUTPUT;
int linearComplexity (BITS_CHECKED *, LINCOMP_PARAMS *, LINCOMP_OUTPUT *);
Block Frequency API
struct blockFrequencyParams { double alpha; /* significance level that determines the resgion of acceptance an rejection. NIST recommends that ALPHA be in the range [0,001, 0,01]. */ int blockLength; };
struct blockFrequencyOutput { int random; /* Random result, 0 => NON RANDOM, 1 => RANDOM) */ double p_value; /* The probability that a perfect RNG would have produced a sequence less random than the sequence tested */ double testTime; /* Test execution time */ double chi_squared; int blocksNumber; int bitsDiscarded; int error; /* Error produced in the test, checked it if 'random = 0' */ };
typedef struct blockFrequencyParams BFREQ_PARAMS; typedef struct blockFrequencyOutput BFREQ_OUTPUT;
int blockFrequency(BITS_CHECKED *, BFREQ_PARAMS *, BFREQ_OUTPUT *);
Cumulative Sums API struct cusumForwardParams { double alpha; /* significance level that determines the resgion of acceptance an rejection. NIST recommends that ALPHA be in the range [0,001, 0,01]. */ };
struct cusumForwardOutput { int random; /* Random result, 0 => NON RANDOM, 1 => RANDOM) */ double p_value; /* The probability that a perfect RNG would have produced a sequence less random than the sequence tested */ double testTime; /* Test execution time */ double cusum; int error; /* Error produced in the test, checked it if 'random = 0' */ };
typedef struct cusumForwardParams CSUMF_PARAMS; typedef struct cusumForwardOutput CSUMF_OUTPUT;
int cSumForward(BITS_CHECKED *, CSUMF_PARAMS *, CSUMF_OUTPUT *);
struct cusumReverseParams { double alpha; /* significance level that determines the resgion of acceptance
an rejection. NIST recommends that ALPHA be in the range [0,001, 0,01]. */ };
struct cusumReverseOutput { int random; /* Random result, 0 => NON RANDOM, 1 => RANDOM) */ double p_value; /* The probability that a perfect RNG would have produced a sequence less random than the sequence tested */ double testTime; /* Test execution time */ double cusum; int error; /* Error produced in the test, checked it if 'random = 0' */ };
typedef struct cusumReverseParams CSUMR_PARAMS; typedef struct cusumReverseOutput CSUMR_OUTPUT;
int cSumReverse(BITS_CHECKED *, CSUMR_PARAMS *, CSUMR_OUTPUT *);
Discrete Fourier Transform API
struct discreteFourierTransformParams { double alpha; /* significance level that determines the resgion of acceptance an rejection. NIST recommends that ALPHA be in the range [0,001, 0,01]. */ };
struct discreteFourierTransformOutput { int random; /* Random result, 0 => NON RANDOM, 1 => RANDOM) */ double p_value; /* The probability that a perfect RNG would have produced a sequence less random than the sequence tested */ double testTime; /* Test execution time */ double percentile; double N_l; double N_o; double d; int error; /* Error produced in the test, checked it if 'random = 0' */ };
typedef struct discreteFourierTransformParams DFT_PARAMS; typedef struct discreteFourierTransformOutput DFT_OUTPUT;
int discreteFourierTransform(BITS_CHECKED *, DFT_PARAMS *, DFT_OUTPUT *);
Longest Run Of Ones API struct longestRunOfOnesParams { double alpha; /* significance level that determines the resgion of acceptance an rejection. NIST recommends that ALPHA be in the range [0,001, 0,01]. */ int long_run_case; };
struct longestRunOfOnesOutput { int random; /* Random result, 0 => NON RANDOM, 1 => RANDOM) */ double p_value; /* The probability that a perfect RNG would have produced a sequence less random than the sequence tested */ double testTime; /* Test execution time */ int N; int M; double chi2; unsigned int assignment[7]; int error; /* Error produced in the test, checked it if 'random = 0' */ }; typedef struct longestRunOfOnesParams LONGRUN_PARAMS; typedef struct longestRunOfOnesOutput LONGRUN_OUTPUT;
int longestRunOfOnes(BITS_CHECKED *, LONGRUN_PARAMS *, LONGRUN_OUTPUT *);
Overlapping Template Matchings API struct overlappingTemplateMatchingsParams { double alpha; /* significance level that determines the resgion of acceptance an rejection. NIST recommends that ALPHA be in the range [0,001, 0,01]. */ int m; };
struct overlappingTemplateMatchingsOutput { int random; /* Random result, 0 => NON RANDOM, 1 => RANDOM) */ double p_value; /* The probability that a perfect RNG would have produced a sequence less random than the sequence tested */ double testTime; /* Test execution time */ int M; int N; double chi2; double eta; double lambda; unsigned int assignment[6]; int error; /* Error produced in the test, checked it if 'random = 0' */ };
typedef struct overlappingTemplateMatchingsParams OVERLAP_PARAMS; typedef struct overlappingTemplateMatchingsOutput OVERLAP_OUTPUT;
int overlappingTemplateMatchings(BITS_CHECKED *, OVERLAP_PARAMS *, OVERLAP_OUTPUT *);
Rank API struct rankParams { double alpha; /* significance level that determines the resgion of acceptance an rejection. NIST recommends that ALPHA be in the range [0,001, 0,01]. */ };
struct rankOutput { int random; /* Random result, 0 => NON RANDOM, 1 => RANDOM) */ double p_value; /* The probability that a perfect RNG would have produced a sequence less random than the sequence tested */ double testTime; /* Test execution time */ double chi_squared; int N; int bitsDiscarded; double p_32, p_31, p_30; /* PROBABILITIES */ double F_32, F_31, F_30; /* FREQUENCIES */ int error; /* Error produced in the test, checked it if 'random = 0' */ };
typedef struct rankParams RANK_PARAMS; typedef struct rankOutput RANK_OUTPUT;
int rank(BITS_CHECKED *, RANK_PARAMS *, RANK_OUTPUT *);
Runs API
struct runsParams { double alpha; /* significance level that determines the resgion of acceptance an rejection. NIST recommends that ALPHA be in the range [0,001, 0,01]. */ };
struct runsOutput { int random; /* Random result, 0 => NON RANDOM, 1 => RANDOM) */ double p_value; /* The probability that a perfect RNG would have produced a sequence less random than the sequence tested */ double testTime; /* Test execution time */ double pi; double V_n_obs; double argument; int error; /* Error produced in the test, checked it if 'random = 0' */ };
typedef struct runsParams RUNS_PARAMS; typedef struct runsOutput RUNS_OUTPUT;
int runs(BITS_CHECKED *, RUNS_PARAMS *, RUNS_OUTPUT *);
Serial API struct serialParams { double alpha; /* significance level that determines the resgion of acceptance an rejection. NIST recommends that ALPHA be in the range [0,001, 0,01]. */ int m; };
struct serialOutput { int random; /* Random result, 0 => NON RANDOM, 1 => RANDOM) */ double p_value1; /* The probability that a perfect RNG would have produced a sequence less random than the sequence tested */ double p_value2; /* The probability that a perfect RNG would have produced a sequence less random than the sequence tested */ double testTime; /* Test execution time */ double psim0; double psim1; double psim2; double del1; double del2; int error; /* Error produced in the test, checked it if 'random = 0' */ };
typedef struct serialParams SERIAL_PARAMS; typedef struct serialOutput SERIAL_OUTPUT;
int serial(BITS_CHECKED *, SERIAL_PARAMS *, SERIAL_OUTPUT *);
Universal API struct universalParams { double alpha; /* significance level that determines the resgion of acceptance an rejection. NIST recommends that ALPHA be in the range [0,001, 0,01]. */ };
struct universalOutput { int random; /* Random result, 0 => NON RANDOM, 1 => RANDOM) */ double p_value; /* The probability that a perfect RNG would have produced a sequence less random than the sequence tested */ double testTime; /* Test execution time */ int L; int Q; int K; double sigma; double phi; double sum; double expected_value; double variance; int bitsDiscarded; int error; /* Error produced in the test, checked it if 'random = 0' */ };
typedef struct universalParams UNIV_PARAMS; typedef struct universalOutput UNIV_OUTPUT;
int universal(BITS_CHECKED *, UNIV_PARAMS *, UNIV_OUTPUT *);
RETURNED ERRORS INSUFFICIENT_MEMORY 1 P_VALUE_OUT_OF_RANGE 2 INSUFFICIENT_NUMBER_OF_BITS 3 ESTIMATION_CRITERIA_NOT_MET 4 RESULTS_INACCURATE 5 L_OR_Q_OUT_OF_RANGE 6 MATHEMATICIAN_NAN 7 LONG_RUNS_CASE_ERROR 8
|