From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,58817e35b044fec5 X-Google-Attributes: gid103376,public From: eachus@spectre.mitre.org (Robert I. Eachus) Subject: Re: searhing for Marsaglia's random Date: 1998/02/12 Message-ID: #1/1 X-Deja-AN: 324544244 References: <34D756FA.78C7AAB9@BNP.Fr> <6b8b3l$s4i$1@uuneo.neosoft.com> Organization: The Mitre Corp., Bedford, MA. Newsgroups: comp.lang.ada Date: 1998-02-12T00:00:00+00:00 List-Id: 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...