Middle-square method

One iteration of the middle-square method, showing a 6-digit seed, which is then squared, and the resulting value has its middle 6 digits as the output value (and also as the next seed for the sequence).
Directed graph of all 100 2-digit pseudorandom numbers obtained using the middle-square method with n = 2.

In mathematics and computer science, the middle-square method is a method of generating pseudorandom numbers. In practice it is a highly flawed method for many practical purposes, since its period is usually very short and it has some severe weaknesses; repeated enough times, the middle-square method will either begin repeatedly generating the same number or cycle to a previous number in the sequence and loop indefinitely.


© MMXXIII Rich X Search. We shall prevail. All rights reserved. Rich X Search