Modern computers actually use several different methods to generate random numbers, and the relationship between time and predictability depends on which method is being used.
For pseudorandom number generators (PRNGs), which are the most common type used in everyday computing, you're partially correct. Many PRNGs are initially "seeded" with the current time (often combined with other values like process IDs or memory addresses). Once seeded, the PRNG uses a deterministic algorithm to produce a sequence of numbers that appear random but are actually completely predictable if you know:
- The seed value
- The algorithm being used
- How many numbers have been generated so far
So yes, if someone logged the exact time used as a seed and knew these other factors, they could reproduce the entire sequence of "random" numbers. This is why PRNGs are unsuitable for cryptographic purposes where unpredictability is crucial.
For security-critical applications, computers use cryptographically secure random number generators (CSPRNGs) or true random number generators (TRNGs). These gather entropy from genuinely unpredictable sources like:
- Thermal noise in circuits
- Timing variations in hard drive operations
- Mouse movements and keyboard timings
- Network packet arrival times
- Specialized hardware that measures quantum phenomena
These sources provide true randomness that cannot be predicted even if you know the exact time. Modern operating systems maintain an "entropy pool" that continuously collects randomness from these sources and uses it to generate unpredictable numbers for things like encryption keys.
So while basic random number generation often does rely on time-based seeds (making it theoretically predictable), security-conscious applications use much more sophisticated methods that remain unpredictable even with perfect timing information.