title: C: srand does not influence random number generator
body: <p>I have the following c code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;time.h&gt;
  
  int main(int argc, char *argv[]) {
    srand(time(NULL));
    printf("%d\n", (int)random());
    return 0;  
  }
  </code></pre>
  
  <p>To my understanding, this should print a different random number every time I execute the program because the random seed is dependent of the system time.</p>
  
  <p>But every time run the program, I get exactly the same output:</p>
  
  <pre><code>1804289383
  </code></pre>
  
  <p>I still get the same output when I put custom values as argument for srand:</p>
  
  <pre><code>srand(1);
  </code></pre>
  
  <p>Or</p>
  
  <pre><code>srand(12345);
  </code></pre>
  
  <p>Does anyone have an Idea why this happens? Maybe it is because of my operating system (Mac OS 10.10.3)? Or the compiler I use (gcc)?</p>
  
  <p>Are there simple alternatives?</p>