Predictable random number generator algorithm
Depending on the exact algorithm, it may be trivial to predict all next outputs given as few as one previous output. It is possible to use some "true" random numbers to seed the state of a pseudo-random generator, but this does not make the PRNG "truly random". There are many different PRNGs out there, some of which are discussed below.
The initial seed can be set, but after that the next state only depends on the previous state. Pseudo-random numbers are generated by an algorithm (a PRNG) that transforms some internal state and calculates an output value upon request. Measurements are de-biased and "stirred" into a pool of entropy, from which random numbers can be extracted. This can be anything from cosmic radiation and atomic decay, to the timing of user input and clock jitter. There are two kinds of random numbers: "true" random and pseudo-random.įor "true" random number generation, the system continuously measures a certain set of events that are expected to be random. These are important distinctions: the former may impact how you design your OS, and the latter can make or break the security of your system. There are multiple ways to divide random number generators one way is by how the numbers are generated, another is by how they can be used. Therefore the timing and nature of input events can provide us with some entropy. Even other computers can provide entropy: while most network traffic is entirely machine generated, the exact relative timing of network packets in the end derives from the moment the power button was pressed, another human action. Humans type on keyboards with an inconsistent timing, and type quasi-random text like the article you are currently reading. A sound recording will contain some level of noise even in the best shielded recording rooms on the planet. Many physical events are random to some degree, or more technically, have some degree of entropy. How, then, can a computer generate random numbers? The computer cannot, but the physical world around it can. If the program is the same and all inputs are the same, the same result will be calculated every time.