Computer Chess Club Archives


Search

Terms

Messages

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

Author: Dieter Buerssner

Date: 12:14:57 07/08/03

Go up one level in this thread


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)

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.

Regards,
Dieter



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.