Unseeded rand() has a purpose. If you're debugging a large and complicated program that is associated with random numbers, it's advantageous to have the same sequence repeat itself. Even if you're not debugging, only testing, it can come in handy.
Unseeded rand() has a purpose. If you're debugging a large and complicated program that is associated with random numbers, it's advantageous to have the same sequence repeat itself.
In that case I would just give it a fixed seed. IE srand(0);. That way you're guaranteed to get the same sequence.
Unseeded is uninitialized. I never want to use anything uninitialized.
There was a definite disconnect with what I wrote to what I was thinking. I really meant to say that a repetitive sequence of random numbers has a purpose.
How about using CryptGenRandom() on windows or reading from /dev/urandom device file on *nix ?
These are cryptographically secure pseudo random number generators used by the operating system itself, probably much better than any <random> implementation.
Still you can exhaust entropy pool even with calls to urandom impairing other users of the machine. YOu should use it with caution. Also they are unusable if you will need to repeat same sequence of random numbers again.
So, learn how each of these methods work, theis upsides and downsides and use what you think better suits you.