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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,CP1252 X-Google-Thread: 103376,3e9f592176b8fb05 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-07-25 11:05:41 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!wn14feed!wn13feed!wn12feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!sccrnsc04.POSTED!not-for-mail Message-ID: <3F217171.2080907@attbi.com> From: "Robert I. Eachus" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20021120 Netscape/7.01 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Random Number Generator Problem References: <30c81431.0307250634.77148b62@posting.google.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit NNTP-Posting-Host: 66.31.71.243 X-Complaints-To: abuse@comcast.net X-Trace: sccrnsc04 1059156340 66.31.71.243 (Fri, 25 Jul 2003 18:05:40 GMT) NNTP-Posting-Date: Fri, 25 Jul 2003 18:05:40 GMT Organization: Comcast Online Date: Fri, 25 Jul 2003 18:05:40 GMT Xref: archiver1.google.com comp.lang.ada:40814 Date: 2003-07-25T18:05:40+00:00 List-Id: Anisimkov wrote: >> I'm generating a series of unsigned 64 bit integers and I get the >> same value for about half of the results. > > > I was reporting this bug to ACT. > > Do not use mod 2**64 types in random generator untill this bug would > be fixed. Use mod 2**63 or multiplication of two random numbers of > mod 2**32. I assume you mean Rand * 2**32 + Rand, where Rand'Modulus = 2**64 and the range of the subtype used to instantiate the generator is any power of two from 32 to 63. If you use Rand * Rand, the distribution is not Uniform. (This can easily be seen. The mean of Rand * Rand is 2**62, not 2**63.) However there is another problem worth noting. If both random values come from the same generator, the period of the combined generator will be half the period of the full generator. This is still going to be about 2**49 with GNAT, so it is not likely to be a big issue yet. ;-) But as I said, I do have it on my to do list to create a generator for types with a range of > 2**48 that has a period greater than 2**64. -- Robert I. Eachus �In an ally, considerations of house, clan, planet, race are insignificant beside two prime questions, which are: 1. Can he shoot? 2. Will he aim at your enemy?� -- from the Laiden novels by Sharon Lee and Steve Miller.