That was not the problem, as the source code is available and it doesn't call system libraries at all. I was initializing with known seed in my tests anyway.

Thanks though, in the process of composing a reply demonstrating the problem, I found a partial solution. Now random number generation takes 3% of running time, compared to 60% of older version and ~1% of a hypothetical ideal solution.

Berk.

Stuart A. Yeates 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/

Reply via email to