title: Problems when calling srand(time(NULL)) inside rollDice function
body: <p>When I used at first  <code>srand(time(NULL))</code> in <code>rollDice()</code> function it did not work. But   when I put it in main, it works. Why is that?
  Can you tell me the logic?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;time.h&gt;
  #include &lt;stdlib.h&gt;
  
  int rollDice(void) {
      return (1+rand()%6) + (1+rand()%6);
  }
  int main(void) {
      int roll;
      srand(time(NULL));          
      roll = rollDice();
      printf("You rolled %d.\n", roll);
  
      enum Gamestatus {WON,LOST,CONTINUE};
      enum Gamestatus status;
  
      while(status==CONTINUE){
          printf("You are rolling again: \n");
          printf("You rolled %d\n", roll = rollDice());
  
          if (targetPoint==roll){
              printf("You win!");
              status=WON;
          }
          else if(7==roll){
              printf("You lost!");
              status=LOST;
          }
          else
              status=CONTINUE;
      }
      return 0;
  }
  </code></pre>