|
Boost Users : |
Subject: Re: [Boost-users] [random] Bias in boost::random generators?
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-05-23 15:03:02
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
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