0

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

26th Oct 2016, 10:33 PM
Andrew MacMillan
Andrew MacMillan - avatar
1 Odpowiedź
+ 3
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.
27th Oct 2016, 12:09 AM
Zen
Zen - avatar