title: Cannot use parameter as an unsigned int with pass by reference C++
body: <p>I have some C++ code:</p>
  
  <pre><code>#include &lt;bjarne/std_lib_facilities.h&gt;
  
  double random(unsigned int &amp;seed);
  int main ()
  {
      int seed = 42;
      cout &lt;&lt; random((unsigned int)seed) &lt;&lt; endl;
  }
  
  double random(unsigned int &amp;seed)
  {
      const int MODULUS = 15749;
      const int MULTIPLIER = 69069;
      const int INCREMENT = 1;
      seed = (( MULTIPLIER * seed) + INCREMENT) % MODULUS;
      return double (seed)/MODULUS;
  }
  </code></pre>
  
  <p>I'm getting an error when I try to compile:</p>
  
  <pre><code>error: invalid initialization of non-const reference of type ‘unsigned int&amp;’ from an rvalue of type ‘unsigned int’
  
  cout &lt;&lt; random((unsigned int)seed) &lt;&lt; endl;
  </code></pre>
  
  <p>I don't understand why I can't use the <code>int seed</code> as a parameter for the function <code>random</code>. I even tried <code>type-casting</code> the int into an unsigned int for the parameter. I can't make the <code>unsigned int &amp;seed</code> parameter a <code>const</code> variable because I'm changing its value within the function. Thanks in advance!</p>