What happens if you run the program at exactly the same time tomorrow?

Will the number still be 'truly random' or will it repeat itself

10/26/2016 10:33:29 PM

Andrew MacMillan

1 Answer

New Answer


time(0) returns the number of seconds since Jan 1, 1970. You won't get the same seed twice with srand(time(0)) (unless you are calling it twice in less than a second). Also, a pseudo-random number generator is not "truly random" as computers are strictly deterministic machines, it only generates numbers that look random, which is usually good enough for a number of uses, like games and simulations.