Boost C++ Libraries: Ticket #5767: A bug in seeding with sequence in Mersenne Twister https://svn.boost.org/trac10/ticket/5767 <p> There is a bug in boost/random/mersenne_twister.hpp: </p> <pre class="wiki"> 176 // fix up the state if it's all zeroes. 177 if((x[0] &amp; (~static_cast&lt;UIntType&gt;(0) &lt;&lt; r)) == 0) { 178 for(std::size_t j = 1; i &lt; n; ++j) { 179 if(x[j] != 0) return; 180 } </pre><p> Since there is a typo in line 178 ("i &lt; n" should be "j &lt; n"), x<a class="missing changeset" title="No changeset 0 in the repository">[0]</a> will always be reset to some constant (static_cast&lt;UIntType&gt;(1) &lt;&lt; (w-1)). </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/5767 Trac 1.4.3 Synge Todo <wistaria@…> Wed, 10 Aug 2011 00:00:03 GMT attachment set https://svn.boost.org/trac10/ticket/5767 https://svn.boost.org/trac10/ticket/5767 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">random.patch</span> </li> </ul> Ticket Marshall Clow Wed, 10 Aug 2011 23:55:26 GMT owner changed https://svn.boost.org/trac10/ticket/5767#comment:1 https://svn.boost.org/trac10/ticket/5767#comment:1 <ul> <li><strong>owner</strong> changed from <span class="trac-author">No-Maintainer</span> to <span class="trac-author">Steven Watanabe</span> </li> </ul> Ticket Steven Watanabe Tue, 30 Aug 2011 21:14:03 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/5767#comment:2 https://svn.boost.org/trac10/ticket/5767#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/74169" title="Use the right variable. Fixes #5767.">[74169]</a>) Use the right variable. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/5767" title="#5767: Bugs: A bug in seeding with sequence in Mersenne Twister (closed: fixed)">#5767</a>. </p> Ticket