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,c76113b004e50a06 X-Google-Attributes: gid103376,public From: Robert Iredell Eachus Subject: Re: Gnat Chat, Random Numbers in GNAT Date: 2000/02/06 Message-ID: <389D1B45.973F3A30@earthlink.net>#1/1 X-Deja-AN: 582180642 Content-Transfer-Encoding: 7bit References: <389CBCBF.1DE4F0F@earthlink.net> X-Accept-Language: en,pdf Content-Type: text/plain; charset=us-ascii X-ELN-Date: Sat Feb 5 22:53:11 2000 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 949819991 63.24.56.82 (Sat, 05 Feb 2000 22:53:11 PST) Organization: EarthLink Network, Inc. MIME-Version: 1.0 NNTP-Posting-Date: Sat, 05 Feb 2000 22:53:11 PST Newsgroups: comp.lang.ada Date: 2000-02-06T00:00:00+00:00 List-Id: Keith Thompson wrote: > If this is an issue, perhaps you can call Random twice for each random > number you need. For example, if the Random function gives you a good > 32-bit value, you can call it twice to construct a good 64-bit value. > > (I'm probably missing some vital point here, so don't take my word for > it.) You are missing a very vital point here, and you can take my word for it. ;-) If you generated random variates as described above, the number of possible generator states would not change, so you would still only generate the same number of different VALUES. They would just have more bits in them. (You would generate the same number of values because the period of the generator is not divisible by 2. With some other generators, this would decrease the number of possible values generated.) The simple rule to remember is that when mixing computers and randomness, entropy always decreases. In this particular example, since the generator would be used with a 32-bit seed, you have a maximum of 32 bits of entropy. If you use two generators, with two independent seeds, you may get 64 bits of entropy, and for a good generator you should expect almost that. Where to you get entropy? The usual source is some physical measurement external to the computer. The most commonly used is the value of the clock. If you really care, you can buy devices that measure Schott noise in diodes or the interval between geiger counter clicks. If Kent has a large processor farm, he may want to splurge and buy one. They usually cost under $100 plus software, the problem is that they usually take up an internal slot or external port. If the situation does arise where you do need more than about 10 million variates, the better way to go is to use a generator with a longer period. Incidently, don't let any of this scare you away from using the built-in generator in gnat. It is very solid, and for complex reasons explained in the paper will pass any reasonable test of randomness.