Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Random keys and hamming distance

Author: Andrew Williams

Date: 03:35:16 08/17/02

Go up one level in this thread


I use the Mersenne-Twister random number generator. This is LGPLed. The online
paper I read about it said that it was designed so that it is OK to catenate two
32-bit numbers into one 64 bit number. Unfortunately the homepage of the authors
is unreachable at the moment (it was always very slow). However, if you search
at google for "mersenne twister", you'll find the source code and some
information. The version I used is here:
http://rosebud.sps.queensu.ca/edd/code/octave-mt/cokus.c.txt

In my code I just do:

long long random64() {
        long long rand;
        int r1, r2;

        r1 = randomMT();
        r2 = randomMT();

        rand = r1;
        rand = rand << 32;
        rand = rand | r2;

        return rand;
}


Andrew



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.