Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: question about optimizing code - puh Heiner is fast!

Author: Reinhard Scharnagl

Date: 12:30:06 07/08/03

Go up one level in this thread


On July 08, 2003 at 15:14:57, Dieter Buerssner wrote:

>On July 08, 2003 at 14:37:56, Reinhard Scharnagl wrote:
>
>>>XORing three random numbers should produce a byte stream
>>>with an average of two bits set (instead of 1.27405)
>>>within a byte.
>>
>>using XORing has to be corrected into using ANDing,
>>and taking only TWO random numbers instead of THREE.
>
>Or one could take 4 random numbers and combine them as
>
>  r1 & r2 & (r3|r4)

I agree 100% here.

>to get an average of 1.5 set bits. Many cheap PRNGs (that typically produce 32
>bits) would do, and the 4 8-bits part of one call could be combined.

As far as I know most only positive numbers will be
generated, therefore this smart idea will not always do,
because the MSB is obviously cleared then.

Regards, Reinhard




This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.