Hasard is a pseudo-random number generator (PRNG) library. It includes multiple engines (algorithms): Mersenne Twister, Park-Miller, Linux device (/dev/urandom or /dev/random). It has simple API but with strong code, eg. PRNG seed can be generated using strong entropy (hardware random number generator like /dev/random on Linux).
The library is written in C and a Python binding is available. The library is distributed under BSD license.
The word "hasard" is the french name of "randomness" or "chance".
Here are some key features of "Hasard":
· Simple functions to get integer, float or boolean with the best distribution
· Support many engines: Mersenne Twister, ISAAC, Arcfour, ... (full list)
· No need to feed the initial seed with poor entropy (eg. srand(time(0))
· Functions to control the seed: jumpahead, get/set seed, get/set state and reseed
· Informations about the PRNG: min/max period, does it support reseed, seed or state?
· BSD license for easy integration in other libraries and programs
· Quality tests: test entropy, compute PRNG period, unit tests
· Attack tests: programs to find collisions, break a LCG
· Tools: programs to create images to "view" the random, plain text file format used by most test programs
What's New in This Release: [ read full changelog ]
· @secure_nonblocking profile: try also dev_nonblocking and cryptgen (after OpenSSL secure and gcrypt strong)
· Add a cache of 512 bytes to tick_array() for byte generators (optimize slow generators as dev_nonblocking or gcrypt_*)
· Create doc/index.rst and doc/profile_list.rst documentation