Strange errors

Pages: 123
So then this code
1
2
3
4
void set_seed(int seed)
{
   srand(seed);
}

doesn't do anything for my program then correct? Unless I somehow call it in my initialize array function.
It will only help if it is called with time(nullptr) as is traditional.

Fun fact: rand is eventually going to be deprecated in favor of the new random generators ;)
Last edited on
yes sorry nullptr is the c++ standard not NULL. And yeah there are much better pseudo random generators than rand() but for beginners rand() is probably the easiest. Check out the others though http://www.cplusplus.com/reference/random/

And I didnt see your srand(seed) that should work. I don't see why it wouldn't. The parameter for a seed is just an unsigned int.
Topic archived. No new replies allowed.
Pages: 123