Boost C++ Libraries: Ticket #6053: uniform_real goes into an infinite loop when lb=ub https://svn.boost.org/trac10/ticket/6053 <p> The following code, compiled on my mac (i686-apple-darwin9-g++-4.2.1) goes into an infinite loop. The problem is in boost::uniform_real&lt;double&gt;(90,90)(rng); as the lower and upper bounds are the same </p> <p> #include&lt;boost/random/uniform_real.hpp&gt; </p> <p> #include&lt;boost/random/lagged_fibonacci.hpp&gt; </p> <p> #include&lt;iostream&gt; </p> <p> int main() { </p> <p> boost::lagged_fibonacci607 rng(32); </p> <p> double r = boost::uniform_real&lt;double&gt;(90,91)(rng); std::cout &lt;&lt; r &lt;&lt; std::endl; </p> <p> r = boost::uniform_real&lt;double&gt;(90,90)(rng); </p> <p> return 0; </p> <p> } </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6053 Trac 1.4.3 Ivan Neeson <zzymyn@…> Thu, 10 Nov 2011 00:17:27 GMT <link>https://svn.boost.org/trac10/ticket/6053#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6053#comment:1</guid> <description> <p> It should be noted that this issue did not occur in Boost 1.46. </p> </description> <category>Ticket</category> </item> <item> <author>matous.ringel@…</author> <pubDate>Tue, 19 Jun 2012 22:27:20 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6053#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6053#comment:2</guid> <description> <p> I confirm this bug in libboost 1.48.0-3, running on Ubuntu 12.04, amd64. In my case it failed for boost::uniform_real&lt;double&gt;(-1,1)(rng); </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Marshall Clow</dc:creator> <pubDate>Tue, 19 Jun 2012 22:54:04 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6053#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6053#comment:3</guid> <description> <p> I can confirm this on the current release branch (which is going to be 1.50 eventually). Mac OS X 10.7.4, Clang 3.1 and gcc 4.2 both. </p> </description> <category>Ticket</category> </item> <item> <author>Edward Rudd <urkle@…></author> <pubDate>Sat, 01 Sep 2012 16:57:45 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6053#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6053#comment:4</guid> <description> <p> Can we have the BOOST_ASSERT in the constructor changed to assert that _min &lt; _max instead of _min &lt;= _max ? since _min == _max is not a supported set of parameters? (according to <a class="missing ticket">#5059</a>) </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Steven Watanabe</dc:creator> <pubDate>Sat, 16 Feb 2013 21:14:25 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/6053#comment:5 https://svn.boost.org/trac10/ticket/6053#comment:5 <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/82937" title="Fix assertion for uniform_real. Fixes #6053. Fixes #6059.">[82937]</a>) Fix assertion for uniform_real. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6053" title="#6053: Bugs: uniform_real goes into an infinite loop when lb=ub (closed: fixed)">#6053</a>. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6059" title="#6059: Bugs: uniform_real_distribution fails when _min = _max (closed: fixed)">#6059</a>. </p> Ticket anonymous Thu, 29 Jan 2015 17:42:56 GMT <link>https://svn.boost.org/trac10/ticket/6053#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6053#comment:6</guid> <description> <p> PS! The documentation still says min &lt;= max. Not sure where to report (or fix) that. </p> </description> <category>Ticket</category> </item> </channel> </rss>