[m-dev.] Random number generation package

Thomas Conway conway at cs.mu.OZ.AU
Thu Aug 30 09:20:51 AEST 2001


On Thu, Aug 30, 2001 at 05:59:26AM EST, Kenneth Almquist wrote:
> The random number generator in Mercury library produces output that is
> obviously nonrandom in some respects.  The low order bit alternates
> between zero and one.  If you initialize the random number generator
> with a seed of 1 and request a series of random permutations of the
> list [1, 2, 3, 4], the last element in every permutation generated
> will be 3.  These regularities in the output won't matter for some
> applications, but for others they will.  So the algorithm used in the
> Mercury library is not useless, but is in my opinion not sufficiently
> general to be included in a general purpose library.  I have therefore
> written a replacement which appears at the end of this message.

If you search through the mercury-users archive, you'll see the source
for a robust, no holes barred, RNG that I translated from George Magalia's
"Mother of all random number generators". It'll be slower than yours,
but it is very robust.

Thomas
-- 
  Thomas Conway )O+
 <conway at cs.mu.oz.au>       499 User error! Replace user, and press any key.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list