Computers require specific programs and algorithms to create sequences. Since random numbers “do not have the law that determines the next number”, the series generated by the computer according to laws such as a specific program cannot be regarded as a random number in the true sense.
But in practice, they can replace real random numbers, or more appropriately, they are “pseudo-random numbers” that can be treated as random numbers.
Computer-generated camouflage random numbers
The first to study pseudo-random numbers was the Hungarian mathematician John von Neumann (1903~1957), the father of computers. Von Neumann’s “square taking method” is the earliest pseudo-random generation method.
John von Neumann, built the prototype of the modern computer. His research has influenced a wide range of fields, from computer game theory to atomic bomb development.
The following are the earliest pseudo-random number generation algorithms studied by von Neumann – the “square neutrality” and the “linear congruence method” still in use today.
Squared in the middle (4-digit case)
Take a 4-digit “seed” (seed of random numbers, in the case 1234 with an underscore). After the seed squares the operation, it gets an eight-digit number (less than eight digits are made up with 0 in front), and the middle 4 digits of this eight-digit number (5227) are taken as the first pseudo-random number. This number (5227) is then followed by the same operation to give the next pseudo-random number (3215). The method of repeating the above operations to continuously obtain pseudo-random numbers is called the square take-in method.
Linear congruence method (4-digit case)
Multiply the seed (1234 with an underscore in the example) by a predetermined fixed number (567 in the example) and add another fixed number (89 in the example) to get a number (699767). Divide this number by a fixed number (9773 in the example) and find the remainder. Take this remainder (1657) as the first pseudo-random number. This 1657 follows the same operation to get the next pseudo-random number (2146). The method of repeating the above operations to continuously obtain pseudorandom numbers is called linear congruence method. When the constant number used in addition is 0, it is called the “multiplication congruence method”.
After von Neumann, various pseudorandom number generation methods led by the “linear congruence method” were developed. A pseudo-random number is only as good as it is “close to a truly random number” and its own “generation speed”. At present, the best pseudo-random number generation algorithm is recognized as the “Mason rotation algorithm” developed in 1998 by Professor Masayoshi Matsumoto of Hiroshima University and Associate Professor Takuto Nishimura of Yamagata University, Japan, which is widely used by programmers around the world. To understand this algorithm requires mathematical knowledge such as vectors and matrices, so it will not be described in detail here, this algorithm cleverly uses the special properties of “Mersenne primes”.
Mason rotation algorithm
There are (2-1) points in the three-dimensional space of the figure below, and the coordinates of each point come from 3 pseudo-random numbers generated using linear congruence. From these points, you can see the pattern or gap of the rule. The figure on the right is the result of using the Mason rotation algorithm to configure the same number of points, and no regular patterns or gaps can be seen.
Of course, the random numbers generated using this method are only pseudo-random numbers, not “real random numbers”. Von Neumann, the father of pseudo-random numbers, once said: “Using formulas to make random numbers is, in a sense, a crime.”