title: C++ generating random numbers
body: <p>My output is 20 random 1's, not between 10 and 1, can anyone explain why this is happening?</p>
  
  <pre><code>#include &lt;iostream&gt; 
  #include &lt;ctime&gt; 
  #include &lt;cstdlib&gt;
  
  using namespace std;
  
  int main() 
  { 
      srand((unsigned)time(0)); 
      int random_integer; 
      int lowest=1, highest=10; 
      int range=(highest-lowest)+1; 
      for(int index=0; index&lt;20; index++){ 
          random_integer = lowest+int(range*rand()/(RAND_MAX + 1.0)); 
          cout &lt;&lt; random_integer &lt;&lt; endl; 
      } 
  }
  </code></pre>
  
  <blockquote>
    <p>output:
        1
        1
        1
        1
        1
        1
        1
        1
        1
        1
        1
        1
        1
        1
        1
        1
        1
        1
        1</p>
  </blockquote>