# If current time in milliseconds is considered good enough random seed for a pseudorandom number generator, why not just use that time directly?

I was reading about pseudorandom number generators and how they need a seed and how that seed is usually current system time in milliseconds. One of the most common algorithms is the linear congruential generator, which is an algorithm that based on some fixed constants and this seed through some mathematical computations gives the final pseudorandom output.

But what are the disadvantages of using this time directly as a pseudorandom number?

• Everyone who attacks a monster this millisecond will do 10 hitpoints of damage. Next millisecond, 11. Next millisecond, 12. In 18 more milliseconds, 30. But the millisecond after that, they'll miss because 30 is the max amount of damage. People will have scripts to wait for the maximum amount of damage before sending the attack command. – user253751 Oct 23 '19 at 11:47

## 2 Answers

The key property that we want from (non-cryptographic) pseudorandom numbers is that they "look" independent. In particular, say you have some algorithm that requires a PRNG to perform well and you give it a current time function as a PRNG. Then, if the algorithm repeatedly queries what is supposed to be a PRNG, it will actually see that it gets the same value many times in a row until, until it eventually increments by one. These values are very, very far from random and can be detrimental to algorithmic performance.

It's not random. It increases by 1 every milliseconds. In computer terms, it stays unchanged for a loooooong time (millions of clock cycles).

But current system time in milliseconds is most definitely not good enough anyway. If an attacker knows that you seeded a random number generator some time today, there are only 86 million possible seed values. Easily brute forced; totally insecure.

• This is assuming that we want cryptographic randomness. There are many other reasons to want randomness that don't require security. – DreamConspiracy Oct 22 '19 at 19:52