title: C++ Get random number from 0 to max long long integer
body: <p>I have the following function:</p>
  
  <pre><code>typedef unsigned long long int UINT64;
  UINT64 getRandom(const UINT64 &amp;begin = 0, const UINT64 &amp;end = 100) {
      return begin &gt;= end ? 0 : begin + (UINT64) ((end - begin)*rand()/(double)RAND_MAX);
  };
  </code></pre>
  
  <p>Whenever I call</p>
  
  <pre><code>getRandom(0, ULLONG_MAX);
  </code></pre>
  
  <p>or</p>
  
  <pre><code>getRandom(0, LLONG_MAX);
  </code></pre>
  
  <p>I <strong>always</strong> get the same value <code>562967133814800</code>. <strong>How can I fix this problem?</strong></p>