Shuffle

Bill Baxter dnewsgroup at billbaxter.com
Mon Jan 28 15:43:30 PST 2008


Sean Kelly wrote:
> Frits van Bommel wrote:
>> Sean Kelly wrote:
>>> Frits van Bommel wrote:
>>>> Both versions would be better if the randomizer eliminated modulo bias,
>>>> though :P.
>>> I just fixed that as well I think.  Let me know if I screwed it up:
>>>
> "The rand function computes a sequence of pseudo-random integers in the
> range 0 to RAND_MAX."

I definitely recall reading that low-order bits of most rand() 
implementations were far from uniform.  So it kind of makes me wonder if 
it's even worth the effort to eliminate the small modulo bias given that 
the underlying random numbers may not be all that random to begin with. 
  That's why I avoided criticizing Tango for not implementing it in my 
previous message, but just commented that it didn't implement it.  It 
has a smell of being the random number generation version of "premature 
optimization".

--bb


More information about the Digitalmars-d-announce mailing list