Subject: [Boost-bugs] [Boost C++ Libraries] #1856: minstd_rand returning different values in 1.35.0 than in 1.34.1
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2008-04-24 05:01:08
#1856: minstd_rand returning different values in 1.35.0 than in 1.34.1
---------------------------------------------------+------------------------
Reporter: Greg Landrum <greg.landrum_at_[hidden]> | Owner: no-maintainer
Type: Bugs | Status: new
Milestone: Boost 1.36.0 | Component: random
Version: Boost 1.35.0 | Severity: Problem
Keywords: |
---------------------------------------------------+------------------------
After moving from boost 1.34.1 to 1.35.0 I have noticed that the
sequence of values returned by the minstd_rand generator has changed.
This sample code (included in the attachment) generates different values
with 1.35.0 than
it did with 1.34.x and 1.33.x:
{{{
typedef boost::minstd_rand rng_type;
typedef boost::uniform_int<> distrib_type;
typedef boost::variate_generator<rng_type &,distrib_type> source_type;
rng_type generator(42u);
unsigned int seeds[] = {12,23,42};
distrib_type dist(0,INT_MAX);
source_type randomSource(generator,dist);
for(unsigned int i=0;i<3;++i){
generator.seed(seeds[i]);
std::cerr << seeds[i];
for(unsigned int j=0;j<5;++j){
unsigned int bit = randomSource();
std::cerr<<" "<<bit%1024;
}
std::cerr<<std::endl;
}
}}}
Output with v1.35.0:
{{{
12 691 854 1010 690 696
23 444 337 394 1000 751
42 404 8 37 977 972
}}}
and with v1.34.1:
{{{
12 691 844 854 975 292
23 214 852 444 337 394
42 883 404 943 348 8
}}}
If I use the mt19937 generator instead of minstd_rand, the sequences
are the same across versions. In the event it matters, I'm using g++
v4.1.3 on an Ubuntu Linux system.
--
Ticket URL: <http://svn.boost.org/trac/boost/ticket/1856>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:57 UTC