title: Issues with rand and srand
body: <p>I'm making a program to get the average number of dice rolls to get a 6, but there seems to be an issue with the RNG. I suspect it's the seed, as while the number is different each time I compile and run the code, it doesn't change in each individual attempt, so the average doesn't change. Heres my code:</p>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cstdlib&gt;    // random numbers header file//
  #include &lt;ctime&gt;    // used to get date and time information
  using namespace std;
  
  int main()
  {
      int roll = 0;       //declare a variable to keep store the random number
      int i = 0;
      int counter = 0;
      int resume = 1;
      int average = 0;
      int totalrolls = 0;
  
      srand(time(0)); //initialise random num generator using time
  
      while (resume != 0) {
          while (roll != 6) {
              roll = rand() % 6 + 1; // generate a random number between 1 and 6
              i++;
          }
          counter++;
          totalrolls += i;
          average = totalrolls / counter;
          cout &lt;&lt; &quot;the average number of rolls to get a 6 is &quot; &lt;&lt; average &lt;&lt; &quot;, based on &quot; &lt;&lt; counter &lt;&lt; &quot; sixes.&quot; &lt;&lt; endl;
          cout &lt;&lt; &quot;do you wish to keep rolling? &quot;;
          cin &gt;&gt; resume;
          cout &lt;&lt; endl;
      }
  
  return 0;
  }
  </code></pre>
  <p>Anyone got any idea what's going on?</p>