
AMDG Tiago de Paula Peixoto wrote:
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<>.
The problem is in uniform_int<>. The behavior of uniform_int depends on the range of the generator. In Christ, Steven Watanabe