January 28, 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
January 29, 2008
Bill Baxter wrote:
> 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".

Well, I figure the impl may as well do what it can, so I'm glad you mentioned it.  If adjusting for the bias had been overly complex I wouldn't have bothered.


Sean
1 2 3 4 5
Next ›   Last »