comp.lang.ada
 help / color / mirror / Atom feed
From: eachus@spectre.mitre.org (Robert I. Eachus)
Subject: Re: searhing for Marsaglia's random
Date: 1998/02/12
Date: 1998-02-12T00:00:00+00:00	[thread overview]
Message-ID: <EACHUS.98Feb12160803@spectre.mitre.org> (raw)
In-Reply-To: 6b8b3l$s4i$1@uuneo.neosoft.com



    I won't tell you why you should use the random-number generator in
GNAT, but I will tell you what some of the limitations (and
advantages) of the Marsaglia's generator are...

    First the Marsaglia generator is not easy to seed.  There are good
starting seed values, and horrible ones, and the package provides no
guidance to selecting one other than the default.

    Second, the Marsaglia generator, by design, generates 24-bit
values between 0.0 and 1.0.  This may be sufficient for your purpose,
but beware.

    The period of the generator is very long.  One way to get around
the seed problem above is to store the current value between runs, and
keep sampling from the same sequence.

    Bad news though, is that the values generated are correlated.  In
particular if you plot pairs of points, you will see that they do not
cover the two-dimensional space, but lie in parallel lines.  The same
thing happens in higher dimensions.  (Technically the difference
between add with carry generators, like the Marsaglia generator and
linear congruential generators is tha in LCGs, the points all fall on
straight lines, and with AWBs, there are occaisonal one-bit shifts in
position.)

    (Well, maybe a bit about the generator in GNAT...  In most
applications, if the values returned by that generator can be shown to
be correlated, then factoring numbers is in P not NP.  In other words,
you won't have to worry about it.)

    Oh, if you want an executable copy of source for the Marsaglia
generator, it has been included with the VADS compiler for many years.
--

					Robert I. Eachus

with Standard_Disclaimer;
use  Standard_Disclaimer;
function Message (Text: in Clever_Ideas) return Better_Ideas is...




  reply	other threads:[~1998-02-12  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-02-03  0:00 searhing for Marsaglia's random Denis WALLEZ-MASKAY
1998-02-03  0:00 ` Pat Rogers
1998-02-12  0:00   ` Robert I. Eachus [this message]
1998-02-13  0:00     ` Nick Roberts
1998-02-03  0:00 ` BSCrawford
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox