Xref: news2.mv.net comp.os.msdos.djgpp:7134 From: lehmann AT mathematik DOT th-darmstadt DOT de (Alexander Lehmann) Newsgroups: comp.os.msdos.djgpp Subject: Re: problem with libm.a "pow" function (and comment on ran()) Date: 12 Aug 1996 19:28:38 GMT Organization: Technische Hochschule Darmstadt Lines: 27 Message-ID: <4uo0l6$1igc@rs18.hrz.th-darmstadt.de> References: <320E4A9F DOT 6E8 AT pobox DOT oleane DOT com> NNTP-Posting-Host: fb0408.mathematik.th-darmstadt.de To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Francois Charton wrote: : While I'm at it, I looked yesterday at the code for rand(), found the : "classical" ANSI linear congruential generator with a small change : : there is some kind of "bit shuffling" of the result: : next = (next<<15) ^ (next >> 27); : Are you sure that this doesn't degrade the randomness of the generator ? : If I remember well, higher bits in such generators are more random than : lower bits, and the shuffling is more or less an "exchange" between : higher and lower bits. Actually, when you want randomness, the rand function isn't of much use anyway. (I think this is even mentioned in some versions of the rand(3) manpage). There are a couple of much improved random functions, including one from BSD, which may or may not be in the djgpp library (random(), I think) or you could get it from the BSD 4.4 distribution. bye, Alexander -- Alexander Lehmann, | "On the Internet, alex AT hal DOT rhein-main DOT de (plain, MIME, NeXT) | nobody knows lehmann AT mathematik DOT th-darmstadt DOT de (plain) | you're a dog."