Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!asuvax!stjhmc!p12.f56.n114.z1.fidonet.org!Chris.Gehlker From: Chris.Gehlker@p12.f56.n114.z1.fidonet.org (Chris Gehlker) Newsgroups: comp.sys.mac.programmer Subject: Re: Is Random() random? Message-ID: <31730.2760E202@stjhmc.fidonet.org> Date: 8 Dec 90 05:29:13 GMT Sender: ufgate@stjhmc.fidonet.org (newsout1.26) Organization: FidoNet node 1:114/56.12 - AZ MAC UG, Phoenix AZ Lines: 19 > hmmm, we're getting picky here. "pseudo-random" is okay. i'd like a > generator that uniformly and pseudo-randomly hits every number in its > range once before repeating and it would be better of i could specify > the range as a parameter or seed. it seems random number generators > can have properties that are optimized to different tastes. If the range is fairly limited, why not fill an array with each value of the range and then shuffle the array by using random to generate array indices and swapping elements. It seems to be pretty generally accepted that if you generate arraySize * 3 suffles you can then just pull elements out of the array and get a uniformly distributed w/o replacement sample set. This is pretty much what the card game and lottery simulators do. -- Uucp: ...{gatech,ames,rutgers}!ncar!asuvax!stjhmc!56.12!Chris.Gehlker Internet: Chris.Gehlker@p12.f56.n114.z1.fidonet.org