Hello All,
I just thought I'd post a bit more info on what it was I was doing.
Here is the pseudo-random number generator that I used:
(from
http://en.wikipedia.org/wiki/Random_Number_Generator)
Code: Select all
#define ZOBRIST_KEYS 1586
// 1586 long ints combine to make 793 64-bit ints
// The seeds for the Zobrist random number generator
unsigned int m_z = 0x12345;
unsigned int m_w = 0xE486B;
// multiply-with-carry method invented by George Marsaglia
unsigned int GetRand(void)
{
m_z = 36969 * (m_z & 65535) + (m_z >> 16);
m_w = 18000 * (m_w & 65535) + (m_w >> 16);
return (m_z << 16) + m_w;
}
Now all I did was set one of the random number seeds to a per-determined value, then performed a loop setting the other value, and testing the resulting set of random numbers it produced.
Code: Select all
void RandSeedGen(void)
{
long int zobrists[ZOBRIST_KEYS+1];
int trials = 1000000;
...
do{
...
m_z = 0x12345;
m_w = 0x67890 + trials;
for (i = 1; i <= ZOBRIST_KEYS; i++)
zobrists[i] = GetRand();
... perform statistical analysis of zobrists here ...
... if fabs(mean - 0.5) and fabs(stddev - 0.288675) <= 0.00001
then report seeds and write list of random numbers ...
}while(trials--);
}
This trial of 1 million produced only three seeds that provided me with a set of numbers that met my criteria, namely that both the mean and the standard deviation would be within 0.00001 of their ideal values.
I also performed a trial of 10 million to see if I could bring the values within the range of +/- 0.000001, but I didn't find any matches. (I'm sure there must be some, but you'd have to look a lot harder than what I did.)
I'm now working on a function that will test other aspects of the set of Zobrist random numbers, one of which is XORing together all the numbers in groups of 3, 4, etc. I'll write back with whatever results I get.
To Diep: I understand the point that you are making about simply combining two unsigned integers into one 64-bit number, that there is no guarantee that the resulting 64-bit numbers will still be random. (I suppose an extreme example of this would be a list of 32-bit integers where half the numbers were odd and occupied the odd-numbered cells of the array. If you then combined all these, you'd get 64-bit numbers that would all be either even or odd, and each of them would have at least two identical bits.) Still, I don't think the risk of that is very great, but I will nevertheless run my numbers against the new test function that I'm writing to see how they do. I may also write it to provide results for the numbers as 32-bit
and 64-bits.
Thanks to everyone who replied, it was an interesting discussion and I learned a lot.