title: C++ randomized number always same even with time(0) as seed
body: <p>Hi I'm trying to generate some random numbers which will be converted to chars later. The problem is the number generated by rand() always return the same although I've used time(0) as the seed for the rand(). </p>
  
  <pre><code>int randomNumber(int min, int max)
  {
      srand(time(0)); 
      int rndm = (rand()%(max-min))+min;
      cout&lt;&lt;rndm&lt;&lt;" ";
      return 0;
  }
  </code></pre>
  
  <p>Let's say I generate the random 3 times</p>
  
  <pre><code>int main()
  {
      randomNumber(0,5);
      randomNumber(0,5);
      randomNumber(0,5);
  }
  </code></pre>
  
  <p>The numbers produced will be 1 1 1 or 2 2 2 etc. Any idea? Thanks</p>