Projects / Hasard


Hasard is a pseudo-random number generator (PRNG) library. It includes multiple engines (algorithms): Park-Miller, Mersenne Twister, Linux device (/dev/urandom or /dev/random), and more. It has a simple but powerful API. For example, a PRNG seed can be generated using strong entropy (using a hardware random number generator like /dev/random on Linux). The library is written in C, and a Python binding is available. The word "hasard" is the French word for "randomness" or "chance".

Operating Systems

RSS Recent releases

  •  16 Jul 2009 08:14

Release Notes: The @secure_nonblocking profile now also tries dev_nonblocking and cryptgen after using OpenSSL secure and gcrypt strong. A cache of 512 bytes was added to tick_array() for byte generators. The documentation was updated.

  •  07 Jul 2009 00:33

Release Notes: This release supports Mac OS X and big endian (PPC32) CPUs. tools/testu01.c, a TestU01 test suite, has been created. There is a new engine: dev_hardware (/dev/random, or /dev/srandom on OpenBSD). The profile "@secure" has been replaced by "@secure_nonblocking" and "@secure_blocking".

  •  13 Jun 2009 12:54

Release Notes: The result of hasard_double(a, b) is now in [a; b( instead of [a; b] form because most libraries use this convention. New KISS, libc_rand, and libc_rand48 engines were included along with a hasard_clone() function. "Weak" engines (minimum_standard, park_miller, randu, etc.) were moved to a new library (hasardweak) to keep only good RNG in the hasard library and to have a smaller memory footprint. The hasard_pow2() function was removed and hasard_ulong() is used instead to detect integer overflows at compile time. All public functions were documented and the Hasard version in which the function was introduced was specified.

  •  11 May 2009 23:36

Release Notes: This release creates the engines gcrypt_nonce, gcrypt_weak, gcrypt_strong, gcrypt_very_strong, gsl, gmp_mt, libc_rand, and libc_rand48. It has a new function hasard_shuffle() to mix elements of an array. glib and OpenSSL libraries and functions are now dynamically loaded (for a smaller memory footprint and easier compilation). This release reseeds the engine in a child process after a fork(). An examples directory ("hello world" and shuffle examples) has been added.

  •  12 Apr 2009 16:02

    Release Notes: Windows support (creation of the cryptgen engine). The addition of OpenSSL and glib engines. Fixes for compiler issues (64-bit CPUs and ISO C). The "support" function has been removed: call directly a function to check whether it is supported or not.


    Project Spotlight

    Kigo Video Converter Ultimate for Mac

    A tool for converting and editing videos.


    Project Spotlight


    A newsletter manager.