Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Random keys and hamming distance

Author: Russell Reagan

Date: 22:05:30 08/16/02

Go up one level in this thread


On August 17, 2002 at 00:51:59, Will Singleton wrote:

>I don't have my source code with me now, but I remember that OR'ing the two
>32-bit values will give very bad results.  There must be lots of examples of
>64-bit rand generation in various sources out there.

In Gerbil, Bruce does:

//	"rand()" produces 15-bit values (0..32767).  I want 64 bits.

static U64 U64Rand(void)
{
	return (U64)rand() ^ ((U64)rand() << 15) ^ ((U64)rand() << 30);
}

Russell




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.