Gunnar Farnebäck: <[EMAIL PROTECTED]>: >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? -Hideki >/Gunnar >_______________________________________________ >computer-go mailing list >computer-go@computer-go.org >http://www.computer-go.org/mailman/listinfo/computer-go/ -- [EMAIL PROTECTED] (Kato) _______________________________________________ computer-go mailing list computer-go@computer-go.org http://www.computer-go.org/mailman/listinfo/computer-go/