Index of /homepages/aspirin/fnvrand

      Name                    Last modified       Size  Description

[DIR] Parent Directory 05-Oct-2008 05:57 - [   ] fnvrand-2003-09-01.t..> 01-Sep-2003 08:26 3k [   ] fnvrand-2004-07-12.t..> 12-Jul-2004 09:45 4k [TXT] fnvrand.README 12-Jul-2004 09:45 2k

*** fnvrand: a fast pseudo-random number generator / v2004-07-12
*** by Adam D. Moss <adam@gimp.org>

fnvrand is a pseudo-random number generator built primarily for speed
and secondarily for pretty good quality of random numbers.  It is very
simple.  It is written in ANSI C.

As a rule of thumb, fnvrand is approximately five times faster than
glibc6's well-regarded rand() function and tests quite comparably in
casual randomness tests ('uliscanc', 'xnoisesphere', parts of DIEHARD,
histogram, and empirical) which probably says more about the uselessness
of casual randomness testing than the quality of fnvrand.

The periodicity of the random sequence is between >2^32 and 2^61 words
depending on the seed value used.  (This is fairly easily improved at the
cost of speed simply by coding a larger seed type.)

The 'secret' of fnvrand is that the random number is generated simply
by taking a rolling 32-bit FNV-1a (Fowler/Noll/Vo variant) hash of a
rolling seed value.  Excess random bits are then XOR-folded.

Inter-call state is currently static for speed and simplicity.  This
code may expand to accept explicit user-passed state structures
at a later time.  The current programming interface is trivial, and
'documented' in the fnvrand.h header.

This pseudo-random number generator is not recommended for
cryptographic work.  You may more or less do with this code as you wish,
with no warranty of any kind; see the 'LICENSE' file for details.

fnvrand.c: The fnvrand implementation
fnvrand.h: Header file for the fnvrand implementation.
example.c: An example/benchmark of generating 100 million random words
period.c : A program to attempt to discover the periodicity of a random stream
README   : This file
CHANGES  : Summary of changes between releases
LICENSE  : Conditions for use (X11/BSD style license)
Makefile : Simple makefile for building fnvrand and the example with gcc

Drop me an email if you like this.
Enjoy,
--Adam D. Moss <adam@gimp.org>