A couple of things I did: I edited the Mersenne Twister code I'm using to get it's seed from the system time in nanoseconds rather than in miliseconds to fix the problem of wanting to generate more than one random number in a millisecond.
Instead of generating a new random number every time I want to pick a move in a random playout, I fill a large circular array with random numbers when my go program launches (before it is actually playing a game) and I have a method that just gets the next number out of the array instead of generating a new random number in real time. Actually I have a different array for each possible board size, since I need a random integer from a different range for each. Sure the array repeats after 500,000 numbers or however many you use, but this is not a big deal when your playouts are only 100 moves long each - and it is unlikely to start repeating from the same position. This approach was much faster than generating random numbers on the fly. On Dec 19, 2007 3:51 AM, Stuart A. Yeates <[EMAIL PROTECTED]> wrote: > Probably the reason that it is so slow is that it's aiming for a > cryptographically random number sequence. These are usually derived > ultimately from kernel timings (often via /dev/random on linux > systems) and it can take a while to establish a degree of confidence > in the randomness of these bits. > > If you want a sequence of numbers that is very unlikely to repeat but > that doesn't have to be cryptographically random, standard practice is > to initialise the random number generator with the current time > (usually a long expressed in milliseconds). This naturally fails if > you ever create more than one sequence per millisecond. > > cheers > stuart > > > On 19/12/2007, Berk Ozbozkurt <[EMAIL PROTECTED]> wrote: > > Hi, > > > > I'm currently writing a UCT based go program in Clean to see if it is > > feasible to write one in a functional language. This is my first attempt > > at functional languages, and I'm having trouble with random numbers. > > > > A mersenne twister module is available for Clean. Once initialized it is > > reasonably fast to extract a new random number from the generator. > > However, it is about a hundred times slower to initialize it with a new > > random seed. Therefore my first attempt at generating random numbers by > > storing seeds at tree nodes and creating a new random list and a new > > seed each time random numbers are required for mc evaluation is very > > slow. The alternative seems to be passing around an index to a global > > random list, which is both ugly and complicated. Is there another way? > > _______________________________________________ > > computer-go mailing list > > [email protected] > > http://www.computer-go.org/mailman/listinfo/computer-go/ > > > _______________________________________________ > computer-go mailing list > [email protected] > http://www.computer-go.org/mailman/listinfo/computer-go/ >
_______________________________________________ computer-go mailing list [email protected] http://www.computer-go.org/mailman/listinfo/computer-go/
