[computer-go] 10k UCT bots
Gunnar Farnebäck
gunnar at lysator.liu.se
Sun May 18 23:19:45 PDT 2008
Hideki Kato wrote:
> Gunnar Farnebäck: <48307B92.9020105 at lysator.liu.se>:
>> Hideki Kato wrote:
>>> I didn't against you, Álvaro, rather I just made a caution for
>>> programmers who will use your pseudo code as is. :)
>>>
>>> First, I prefer SFMT (SIMD-oriented Fast Mersenne Twister) rather
>>> than integer pseudo random number generators in practice where the
>>> quality of play-out is important. Modern processors execute floating
>>> operations as fast as interger ones and
>>> picked = mt_rand() * (double) num_candidates;
>>> is the simplest and safe.
>> Please note that for uniformity purists this method has exactly the
>> same problem as good_quality_int_rand() % num_candidates.
>
> Mt_rand() has very good uniform distributions in [0..1)
> while
> good_quality_int_rand() % num_candidates
> doesn't disribute uniformly when num_candidates is not a power of 2,
> assuming good_quality_int_rand() ranges [0..2^32 or so) due to modulo
> operations. They are not the same, aren't they?
Well, there's nothing magic about floating point numbers. Even a very
good uniform distribution in some interval is implemented by
distributing N discrete values over the interval as uniformly as
possible. When those N values by some mapping procedure are transformed
into a smaller range M, some of those will get at least one more hit
than some others, unless M divides N. It doesn't matter whether the
mapping procedure is an integer modulo operation or a floating point
multiplication + rounding.
/Gunnar
More information about the computer-go
mailing list