title: Is it a good idea to put srand() in the header file?
body: <p>My program includes a function that uses <code>rand()</code>. That function will be called more than once so I can't put <code>srand()</code> at the beginning of the function. Now, is there a general rule that suggests whether <code>srand()</code> should be put in the header file of the function, or in the beginning of the main function?</p>
  
  <p>My understanding is that both would work the same. The only difference is that if I want to reuse the function in the future, having <code>srand()</code> in the header makes the function more self-contained, but I may end up with multiple headers all having <code>srand()</code>.</p>
  
  <p>--Edit--</p>
  
  <p>Yes, I mean something like</p>
  
  <pre><code>/*header.h*/
  srand();
  void my_funciton();
  </code></pre>
  
  <p>So it won't work?</p>