[erlang-questions] Implementation of a 2006 version of Wichmann-Hull random number generator for Erlang/OTP

Richard O'Keefe <>
Wed Nov 24 00:49:01 CET 2010


I made the mistake of downloading the reference implementation of
the new Wichmann-Hill RNG.  Unfortunately, it is *licenced* software,
with provisions like

	The User may only make one copy of the Software and any
	associated written material, as a back up.

Arguably, this means that having downloaded it on my desktop machine,
for which backups are *automatically* made, I do not have the right
to copy it to my laptop.  Another restriction:

	The User will not rent, lease, sublicense, transfer, resell
	the Software (either in whole or in part) or use it for
	commercial purposes without NPL’s prior written permission.

This pretty clearly means you can't put it in open source software.

It's not completely clear just what NPL intend here.  I wrote to
Wichmann about it and he said that kind of stuff was outside his
expertise, but if there was any doubt, change one of the primes.
It's probably worth asking NPL formally if they have any problem
with free implementations *not* derived from their code.

A thing that neither the 'small.pdf' nor the 'long.pdf' version of
the paper that comes with the reference implementation discusses
is how to initialise the generator.  They *do* describe how to set
up multiple instances of the generator, *assuming* that you know
how to set up a single instance.

The NPL package sets it from the time() function, which clearly
provides at most 32 bits.  The generator has 16 bytes worth of
state.  In C, it might be advisable to use gettimeofday() and
get a few more bits.  To get the full range of possible RNG
states, you're looking at using /dev/random.




More information about the erlang-questions mailing list