[Boost-bugs] [Boost C++ Libraries] #5767: A bug in seeding with sequence in Mersenne Twister

Subject: [Boost-bugs] [Boost C++ Libraries] #5767: A bug in seeding with sequence in Mersenne Twister
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-08-09 23:58:37


#5767: A bug in seeding with sequence in Mersenne Twister
-------------------------------------------------+--------------------------
 Reporter: Synge Todo <wistaria@…> | Owner: no-maintainer
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: random
  Version: Boost 1.47.0 | Severity: Regression
 Keywords: |
-------------------------------------------------+--------------------------
 There is a bug in boost/random/mersenne_twister.hpp:
 {{{
    176 // fix up the state if it's all zeroes.
    177 if((x[0] & (~static_cast<UIntType>(0) << r)) == 0) {
    178 for(std::size_t j = 1; i < n; ++j) {
    179 if(x[j] != 0) return;
    180 }
 }}}
 Since there is a typo in line 178 ("i < n" should be "j < n"), x[0] will
 always be reset to some constant (static_cast<UIntType>(1) << (w-1)).

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/5767>
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:50:07 UTC