Message-ID: <3397CBCF.6536@pobox.oleane.com> Date: Fri, 06 Jun 1997 10:35:27 +0200 From: Francois Charton Organization: CCMSA MIME-Version: 1.0 To: billc AT blackmagic DOT tait DOT co DOT nz CC: djgpp AT delorie DOT com Subject: Re: One method for small random nuimbers References: <2 DOT 2 DOT 32 DOT 19970604162434 DOT 0069d50c AT gate> <3395B097 DOT 5077 AT cornell DOT edu> <339830A6 DOT 672 AT blackmagic DOT tait DOT co DOT nz> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Precedence: bulk Bill Currie wrote: > > Basicaly, I treat the number received from the main RNG as a > bit stream and pull off the bits as needed. > I read about such a method being a bad thing in several books (Numerical Recipes warns a lot against this, and I remember reading something about it in Knuth, I'll dig it out tonight). In general, for RNG, "handmade" methods are always dangerous, and by slightly tweaking any good RNG, you can make a bad one out of it. An example of this was DJGPP rand() from a previous version (v2.00 and before): it used the ANSI rand() function, not excellent, but not terrible either, but instead of returning the number, it did some bit exchanging and shifting on the result; this looked like a good idea, but actually the resulting generator was bad (it had a low period). I believe books warn against interpreting random numbers as random sequences of bits because the subject (independence of the bits inside a random number) has not been researched enough. If randomness of the numbers is very important to you, I would be careful with this method. Francois