title: C++11 random number generator UIntType contradiction
body: <p>Section 26.5.1.1 paragraph 1 of the C++11 standard (N3242) says:</p>
  
  <blockquote>
    <p>Throughout this subclause 26.5, the effect of instantiating a template:</p>
    
    <p>[...]</p>
    
    <p>f) that has a template type parameter named <code>UIntType</code> is 
    undefined unless the corresponding template
    argument is cv-unqualified and is one of <code>unsigned short</code>, <code>unsigned int</code>, <code>unsigned long</code>, or <code>unsigned long long</code>.</p>
  </blockquote>
  
  <p>And it defines the linear congruential generator in 26.5.3.1. The definition of the class starts like this:</p>
  
  <pre><code>template&lt;class UIntType, UIntType a, UIntType c, UIntType m&gt;
  class linear_congruential_engine
  </code></pre>
  
  <p><code>minstd_rand0</code> seems to violate this restriction:</p>
  
  <pre><code>typedef linear_congruential_engine&lt;uint_fast32_t, 16807, 0, 2147483647&gt;
      minstd_rand0;
  </code></pre>
  
  <p>As it uses uint_fast32_t (which isn't guaranteed to be one of <code>unsigned short</code>, <code>unsigned int</code>, <code>unsigned long</code>, or <code>unsigned long long</code>) in <code>minstd_rand0</code> for a template parameter named <code>UIntType</code>, it appears to have undefined effect to <code>#include &lt;random&gt;</code>, or at least to use <code>minstd_rand0</code>. This problem applies to other predefined RNGs as well, and it does not appear to be fixed in C++14.</p>
  
  <p>My questions are:</p>
  
  <ul>
  <li>Is this really a contradiction (or rather an extreme amount of undefined behaviour), or have I missed something?</li>
  <li>Has this been mentioned in a defect report?</li>
  </ul>
  
  <p><strong>Edit:</strong> I have noticed that <a href="http://cplusplus.github.io/LWG/lwg-closed.html#2326" rel="nofollow noreferrer">this</a> defect report seems to be related to this problem.</p>