Giter Site home page Giter Site logo

randest's Introduction

Randest

Tool for randomness testing of data.

For a more detailed explanation, refer to paper/documentation.pdf. (in Bulgarian)

Compiling

Linux

> git clone https://github.com/renegat96/randest/
> cd randest/
> cd src/
> mkdir bin
> g++ -std=c++11 -Wall -O2 main.cpp -o bin/randest -Iinclude -lgmp -lgmpxx
> g++ -std=c++11 -Wall -O2 lcg.cpp -o bin/lcg -lgmp -lgmpxx

Windows

Another way to build Randest is by using CodeBlocks. One should add the include/ directory in the include path by the compiler options in the IDE.

It is very important to turn C++11 support on. Unless so, there will be compile errors.

A thought worth considering is installing Cygwin and referring to the previous section.

Usage

usage: randest --int|--double
               [--stdin|--binary-file path]
                --kstest |
                --freqinterval lower upper |
                --freqpresent |
                --coupon n t upper |
                --maxtest groupsize |
                --monotone t [--increasing|--decreasing] |

The first argument should always be either "--int" or "--double" to specify the type of data input.

What may follow is a specification of what is the source of data. Default value is --stdin. As of now only two modes are supported. It is possible to adjust the cache size when reading from a file, though it requires modifying the source.

The last option is the test to be run. Specify exactly one test with all its parameters. An exception is the monotone test - whether to examine increasing or decresing subsequences defaults to increasing, if not explicitly stated otherwise.

Examples

The following execution of Randest will try to read the given file in binary mode, take as many long long variables and apply a chi-squared test on the resulting sequence:

> randest --int --binary-file file/with/binary/string --freqpresent

Another way to use it is shown here. This would read doubles from standard input as long as there are some and then give the Kolmogorov-Smirnov statistic of the sequence. Piping allows reading from a file.

> randest --double --stdin --kstest < file/with/a/sequence/of/doubles

And the last example given here is this:

> randest --int --stdin --coupon 100000 400 100 < file/with/nonnegative/integers/less/than/100

This parametrization of the coupon-collector's test is as follows:

  • the collector will take at most 100000 collections;
  • all collections larger than 400 items will be considered 400 of length;
  • the input to the test is less than 100.

Testing libraries

In order to examine the results of different tests and reproduce them a few files have been written. To use them, one has to go to the src/tests/ directory and execute any of the given files.

The result

For a given linear congruential generator the spectral test will be executed. As a comparison, the K-S test over 1 000 000 generated by the generator will be run also. The sequence will be stored in a file called src/tests/generated.

Expectations

Overall, one should expect a very good performance of the generators on the K-S test by all LCGs. Due to weaknesses though, most of the generators will fail the spectral test.

This requires bash, thus Linux or Cygwin.

randest's People

Contributors

renegat96 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.