|
Boost Users : |
Subject: [Boost-users] [random] Bias in boost::random generators?
From: Tiago de Paula Peixoto (tiago_at_[hidden])
Date: 2009-05-23 05:03:59
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
I'm experiencing a bug with the boost::random library. Apparently, most
generators, together with uniform_int<>, produce heavily biased sequences.
I'm sending attached a small test program which generates several
random walks on a lattice, starting from the center, and counts how
many times a site has been visited. It uses both the boost::random
generators, and the tr1::random generators from GCC 4.3, and writes
the separate counts in the files "bcount" and "tcount", respectively.
A plot of the output with boost::random can be seen here:
http://dl.getdropbox.com/u/280654/boost_random.png
There is an obvious tendency towards the (0,0) corner of the lattice...
With tr1::random, everything looks normal:
http://dl.getdropbox.com/u/280654/tr1_random.png
Not to mention I used the same generator (mt19937) with the same seed
value in both cases, which should have given the exact same sequence!
I obtain similar results with other generators, except with minstd_rand,
where the sequences from both libraries are the same. This lead me to
conclude that the problem is with the generators themselves, not with
uniform_int<>.
More info on my end:
platform: x86_64 intel, GNU/Linux
GCC: 4.3.3
Boost: 1.37
Best regards,
Tiago
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkoXu/8ACgkQBNxGHvNv411+4QCfSfgo1Mu1lROQhwPnGxtEoq51
C1MAn1GJi0BYVtyExFmfdsxvtpKOM/fk
=CsWe
-----END PGP SIGNATURE-----
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net