How to: Make multiple seed generations

I have a question. Right now I'm working on rather simple game. But it has many randomizations. About 10 of them on each run and it's running it over and over. I'm using srand(time(NULL)) and rand()%x+y. Still, it often sends me series of same numbers or even complete set of for example fives. What do I need to do to get rid of this problem? Thanks in advance :)
Last edited on
You should only call srand() once, at the beginning of your program.
Don't do that. You are abusing the random number generator.

Use srand( time( NULL) ); to seed the RNG once somewhere at the beginning of your game. After that just use rand() to get random numbers.

The libc RNG is usually sufficient for simple games, but still, it is fairly wimpy. You may want to google around for a better one.

Hope this helps.

[edit] argh, too slow again... :-P [/edit]
Last edited on
Topic archived. No new replies allowed.