srand() and multiple classes

Hello, I've been having a minor issue with a game I'm writing in Codeblocks using SDL. My problem is, srand(). I seed it to time like so in the main function:

srand(time(NULL));

And functions utilising rand() in main() do have true randomness.

However, when I call rand() from an external file (for instance, a class called Rain in the file rain.h which automatically sets its x to a random position), I get the same seed each time, a.k.a, the rain always falls in the exact same pattern. I assume this is because the random seed is not passed between files, but I have no idea how to enable it.

Thanks for any help in advance.
How many times do you call srand? Do objects of the classes get initialized before or after you call srand (are they global)?

srand should affect the entire program.
...OOPS! Man I feel silly. I declared a few objects BEFORE I called srand(). Yep, it's fixed now.
Thanks!
Topic archived. No new replies allowed.