Xref: utzoo comp.sources.d:4540 comp.sources.games.bugs:1363 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!uunet!zephyr.ens.tek.com!orca.wv.tek.com!frip!andrew From: andrew@frip.WV.TEK.COM (Andrew Klossner) Newsgroups: comp.sources.d,comp.sources.games.bugs Subject: rand() Message-ID: <5814@orca.wv.tek.com> Date: 9 Jan 90 22:39:10 GMT References: <815@stealth.acf.nyu.edu> <2597@cunixc.cc.columbia.edu> <2434@stealth.acf.nyu.edu> Sender: andrew@orca.wv.tek.com Reply-To: andrew@frip.wv.tek.com Followup-To: comp.sources.d Distribution: usa Organization: Tektronix, Wilsonville, Oregon Lines: 16 [] "It's generally safe to use rand() modulo various small numbers, even for linear congruential sequences; unless those small numbers are all powers of two and you're very unlucky, the small period of rand()'s low-order bits won't affect anything." I vehemently disagree. It's generally unsafe to generate a linear congruential sequence, then take the elements modulo various small numbers. This is discussed in the standard reference: Knuth volume II. -=- Andrew Klossner (uunet!tektronix!frip.WV.TEK!andrew) [UUCP] (andrew%frip.wv.tek.com@relay.cs.net) [ARPA]