The probability distribution of a random process provides how probable certain outcomes are. When the probability distribution is uniform (uniform distribution, uniformly distributed, equidistributed, etc), it means that all outcomes have the same probability or each number is as likely to be generated as any other. In other words, when you roll a dice, each outcome (from 1 to 6) is as likely to appear. (In an unrelated note, there is no way to predict the outcome of a
truly random process.)
A pseudo-random number generator (PRNG) generates pseudo-random numbers instead of random numbers, which basically share the same statistical properties of random numbers, in other words, have no distinct patterns (or streaks as it is called before). PRNGs usually start with an initial state and by using a transition function on these states it produces an output. The PRNG algorithm mentioned by Bleak is proposed to generate uniform pseudo-random numbers.
A very very old example of a PRNG is the linear congruential generator:
next_number = (a*(
current_number) + b) mod m. Let a = 2, b = 7 and m = 10 with
initial_number (first
current_number) = 1 .
next_number = (a*(
current_number) + b) mod m = (2*(
1) + 7) mod 10 = 9. Now, with
current_number = 9, the
next_number is : 7. If we continue, we get: 1, 9, 7, 3, 4, 6, 1, 9, 7, 3...
As you have already noticed, it looped back after 6, so we don't have the best algorithm here but still the initial sequence up to 6 looks random. Java programming language actually uses a variant of the algorithm above to generate random numbers (java.util.Random, with a = 25214903917, b = 11 and m = 2^48). However, we only checked it to see a basic PRNG.
One common programming error on PRNGs is not checking for thread safety, or the manipulation of the shared current state by separate processes, especially when using it in parallel. While this might explain "streaks", it is an unlikely error.
Also, as we already discussed with
O'Brien before, a random sized subset (eg.
Tina's set of ten non-consecutive numbers generated by the PRNG from above) of a uniformly distributed random sequence, especially if the size is rather small, does not guarantee a uniform distribution nor does it mean it will be free of patterns. He pointed out the effects of
clustering illusion on that discussion, and while I don't agree that it explains the so called patterns, I still agree that we tend to remember what appears to be patterns more often.