Boost C++ Libraries: Ticket #819: uniform_int<> with type's maximum availaible range error https://svn.boost.org/trac10/ticket/819 <pre class="wiki">using boost 1_33_1, MSVC 8.0 using namespace boost; using namespace std; typedef int32_t IntType;// the same bug for int8_t int16_t int64_t uniform_int&lt;IntType&gt; ui(numeric_limits&lt;IntType&gt;::min(), numeric_limits&lt;IntType&gt;::max()); rand48 rng; variate_generator&lt;rand48, uniform_int&lt;int32_t&gt; &gt; gen(rng, ui); IntType x = gen(); // infinite loop here If we makes range smaller or if we using unsigned types - everything is OK So if we will look to uniform_int.hpp we will see..... template&lt;class IntType = int&gt; class uniform_int { public: .... typedef IntType result_type; .... explicit uniform_int(IntType min = 0, IntType max = 9) : _min(min), _max(max) { ...... assert(min &lt;= max); init(); }..... private: result_type _min, _max, _range; void init() { _range = _max - _min;// for SIGNED types and maximum available range we will receive..... of course -1 !!!!!! } ......}Also i want to draw the attention russian-speaking boost developers to the http://rsdn.ru/Forum/Message.aspx?mid=2252961&amp;only=1 </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/819 Trac 1.4.3 Marshall Clow Sat, 09 Feb 2008 01:13:05 GMT owner, status, description changed; severity set https://svn.boost.org/trac10/ticket/819#comment:1 https://svn.boost.org/trac10/ticket/819#comment:1 <ul> <li><strong>owner</strong> changed from <span class="trac-author">jmaurer</span> to <span class="trac-author">No-Maintainer</span> </li> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">new</span> </li> <li><strong>description</strong> modified (<a href="/trac10/ticket/819?action=diff&amp;version=1">diff</a>) </li> <li><strong>severity</strong> → <span class="trac-field-new">Problem</span> </li> </ul> Ticket Steven Watanabe Sun, 22 Feb 2009 19:36:23 GMT status, resolution changed https://svn.boost.org/trac10/ticket/819#comment:2 https://svn.boost.org/trac10/ticket/819#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-old">None</span> → <span class="trac-field-new">fixed</span> </li> </ul> <p> This was fixed in <a class="changeset" href="https://svn.boost.org/trac10/changeset/34876" title="address uniform_int&lt;&gt; signed/unsigned/overflow issues (noted by ...">[34876]</a> </p> Ticket