title: Random number generator gives consistent results
body: <p>So the goal of my program is to simulate flipping a coin. I'm trying to use a random number generator to generate the number 1 or 2, 1 for heads, 2 for tails. </p>
  
  <p>However I keep getting Tails as the result, where am I going wrong?</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cstdlib&gt; // Require for rand()
  #include &lt;ctime&gt;   // For time function to produce the random number
  using namespace std;
  
  // This program has three functions: main and first.
  
  // Function Prototypes
  void coinToss();
  
  int main()
  {
    int flips;
  
     cout &lt;&lt; "How many times would you like to flip the coin?\n";
     cin &gt;&gt; flips;    // user input
    if (flips &gt; 0)
    {
       for (int count = 1; count &lt;= flips; count++) // for loop to do action based on user input
      { 
       coinToss();    // Call function coinToss
      }
    }
    else
    {
      cout &lt;&lt; "Please re run and enter a number greater than 0\n";
    }
    cout &lt;&lt; "\nDone!\n";
    return 0;
  }
  
  void coinToss() //retrieve data for function main
  {
    unsigned seed = time(0);  // Get the system time.
    srand(seed); // Seed the random number generator
    int RandNum = 0;
  
      RandNum = 2 + (rand() % 2); // generate random number between 1 and 2
  
      if (RandNum == 1) 
      {
        cout &lt;&lt; "\nHeads"; 
      }
      else if (RandNum == 2)
      {
        cout &lt;&lt; "\nTails";
      }
  }
  </code></pre>