“I don’t really understand what a seed is” – A seed in the context of a Pseudo Random Number Generator (PRNG) is a starting value to use for the generation of the pseudo random sequence.
A PRNG that starts with the same seed will (in most cases) produce the same sequence of random numbers. This is great for replayability of a scenario, but is not generally what you want in production. Usually you want to provide a unique/unpredictable seed to the generator for each instance of the application, so that each run gives a unique stream of pseudo random numbers.
I would recommend using the new random facilities (since C++11) that are available in the random header over srand()
/rand()
since rand
has a very low range and usually also a very low period. The new facilities are much better.
You may also find this talk enlightening: rand() Considered Harmful
The Wikipedia page on pseudo random number generators is also worth a read.
solved What exactly is a PRNG seed and how does it work in c++?