title: Rand generating same numbers
body: <p>I have a problem with the small game that I made.</p>
  
  <pre><code>#include "stdafx.h"
  #include &lt;iostream&gt;
  #include &lt;cstdlib&gt;
  #include &lt;ctime&gt;
  using namespace std;
  
  int main()
  {
  int span = 100;
  srand(time(0));
  int TheNumber = static_cast&lt;double&gt; (rand()) /RAND_MAX * (span -1) +1;
  cout &lt;&lt; "You need to guess the number between 1 and " &lt;&lt; span &lt;&lt; endl;
  int mynumber;
  int numberofAttempts = 0;
  
  do {
      cout &lt;&lt; ++numberofAttempts &lt;&lt;" Attempt: ";
      cin &gt;&gt; mynumber;
      if (mynumber &gt; TheNumber)
          cout &lt;&lt;"Lower!" &lt;&lt; endl;
      else if (mynumber &lt; TheNumber)
          cout &lt;&lt;"Higher!" &lt;&lt; endl;
  } while (mynumber != TheNumber);
  
  cout &lt;&lt; "SUCESS!!!" &lt;&lt; endl;
  return 0;
  }
  </code></pre>
  
  <p>The game is supposed to generate a random number between 0-100 and you are supposed to guess it. After running this code 15-20times the same numbers generated some even 8 times (the number 2 in my case).</p>
  
  <p>I know that there is no absolute random number and that it uses some math formula or something to get one.I know that using <code>srand(time(0))</code> makes it dependent on the current time. But how would I make it "more" random, since I don't want the stuff to happen that I mentioned above.</p>
  
  <p>First time I ran it the result was 11, after running it again (after guessing the right number) , it was still 11, even though the time changed.</p>