If you use the same random generator, with the same seed and the same start sequence, the results will be the same. A computer, after all, is determined in its behavior (modulo problems with flows and several other coefficients and ends).
If you do not specify a generator, the default generator implementation is defined. Most implementations, I think, use std::rand() (which can cause problems, especially when the number of elements in a sequence is greater than RAND_MAX ). I would advise getting a generator with a known quality and its use.
If you misuse the generator that is being used (another reason not to use the default value, since how you sow it will depend on), then you will get what you get. In the case of std::rand() , the same seed is always used by default. How you seed depends on the generator used. What you use to sow it must be different from one run to another; for many applications, time(NULL) sufficient; on a Unix platform, I would recommend reading, however, it takes a lot of bytes from /dev/random . Otherwise, hashing other information (machine IP address, process ID, etc.) can also improve the situation --- this means that two users running the program in exactly the same second will still receive different sequences. (But this is really true if you work in a network environment.)
source share