hasard /

Filename Size Date modified Message
cmake
doc
examples
lib
python
tests
tools
weak
107 B
214 B
1.2 KB
293 B
1.1 KB
9.2 KB
1.9 KB
1.7 KB
2.5 KB
2.0 KB
5.6 KB
173 B
171 B
3.9 KB
3.0 KB
116 B
++++++++++++++
Hasard library
++++++++++++++

Hasard
======

Hasard is a pseudo-random number generator (PRNG) library. It includes multiple
engines (algorithms), examples: Arcfour, Mersenne Twister and Linux /dev/random
device. It hides internal details to give a simple API. You don't choose
directly the engine but a profile like "@fast" or "@secure_blocking": Hasard
chooses the best engine and the best seed for you.

Hasard is tested on Linux, FreeBSD and Windows. It is distributed under the BSD
license and written in C (a Python binding is also available). The code is well
tested by unit tests and the project includes many programs to test the
generators quality.

The word "hasard" is the french name of "randomness".

Website: http://bitbucket.org/haypo/hasard/


Features
========

Easy
----

 * Simple API with high level functions and uniform distribution
 * Generic functions to get/set generator seed and state, and to reseed the
   generator
 * Reuse existing libraries: OpenSSL, gcrypt, GSL, GMP, glib, etc.
 * Informations about the generator: name, min/max period, tick range, etc.

Safe
----

 * Choose the best generator for your needs and your environment (Linux,
   Windows, FreeBSD, etc.) using profiles (eg. "@fast" or "@secure_blocking")
 * Automatically seed the engine using good quality source
 * Thread safe: reentrant functions, support lock callbacks
 * Reseed the engine at fork()

Tests
-----

 * Include many unit tests
 * Reuse existing PRNG test programs like TestU01, dieharder and ENT


Why using Hasard instead of just rand() or /dev/urandom?
========================================================

It's hard to write algorithms with uniform distribution and most people write
buggy functions. Hasard initializes the generator seed from a good entropy
source (eg. instead of the current time or process identifier). Hasard code is
also tested by unit tests to ensure that the distribution is correct.

Hasard always choose the best generator depending of the available generators,
eg. use gcrypt_strong if openssl_secure is not available.

Read doc/common_errors.rst document for more information about common errors in
pseudo-random number generators.


Documentation
=============

Start with doc/index.rst. You can also browse "examples/" subdirectory.


Library goals
=============

 * Simple API
 * Avoid common errors like poor seed (time, process identifier) or a biais in
   number generation (eg. rand()%10)
 * Be used by all open source projects: distributed under a BSD license
 * Well tested library: unit tests, regression tests, entropy tests, ...

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.