Rand() to close to Rand()

Hi had a quick newb question.

Lets say I was working on a game that a character was attacking a goblin. There will be 2 rand() used if the character hits the goblin. Once for the attack and one for damage.

The problem I am having is that the two rand() are to close together and are returning the same number. I am seeding the rand() with time so it seems that it is to fast to change the time to give me a new random number. How do I make it so I can produce random numbers one right next to another?
Only seed it once. Only once.

1
2
3
4
int main() {
    srand(time(NULL));
    //your code here that doesn't call srand();
}
I must have seeded it twice at some point in my code and didn't notice it. Thought that it may be just grabbing it to fast or something. Thanks will look into it.
Topic archived. No new replies allowed.