title: Why does rand() + rand() produce negative numbers?
body: <p>I observed that <code>rand()</code> library function when it is called just once within a loop, it almost always produces positive numbers.</p>
  
  <pre><code>for (i = 0; i &lt; 100; i++) {
      printf("%d\n", rand());
  }
  </code></pre>
  
  <p>But when I add two <code>rand()</code> calls, the numbers generated now have more negative numbers.</p>
  
  <pre><code>for (i = 0; i &lt; 100; i++) {
      printf("%d = %d\n", rand(), (rand() + rand()));
  }
  </code></pre>
  
  <p>Can someone explain why I am seeing negative numbers in the second case?</p>
  
  <p>PS: I initialize the seed before the loop as <code>srand(time(NULL))</code>.</p>