• Welcome to CableDataSheet, Cable and Wire Technical Consulting Service.
 

News:

You are not allowed to view links. Register or Login
You are not allowed to view links. Register or Login
You are not allowed to view links. Register or Login
You are not allowed to view links. Register or Login
Tacettin İKİZ



Main Menu

What is the Middle Square Method ?

Started by tacettin, October 27, 2024, 06:03:24 PM

Previous topic - Next topic

tacettin

What is the Middle Square Method ?

The Middle Square Method is a simple pseudo-random number generator developed by John von Neumann. It's one of the earliest techniques for generating random numbers. The method involves squaring a number and then taking the middle part of the result as the next number in the sequence.

How It Works

Start with an initial seed: This is the initial number you begin with.

Square the seed: Compute the square of the seed.

Extract the middle digits:
Select the middle part of the squared number as the next seed.

Repeat the process:
Use the new seed to generate the next number.



You are not allowed to view links. Register or Login

tacettin

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.

The method was invented by John von Neumann, and was described by him at a conference in 1949.[1]

In the 1949 talk, Von Neumann quipped that "Anyone who considers arithmetical methods of producing random digits is, of course, in a state of sin." What he meant, he elaborated, was that there were no true "random numbers", just means to produce them, and "a strict arithmetic procedure", like the middle-square method, "is not such a method". Nevertheless, he found these methods hundreds of times faster than reading "truly" random numbers off punch cards, which had practical importance for his ENIAC work. He found the "destruction" of middle-square sequences to be a factor in their favor, because it could be easily detected: "one always fears the appearance of undetected short cycles".[1] Nicholas Metropolis reported sequences of 750,000 digits before "destruction" by means of using 38-bit numbers with the "middle-square" method.[2]

The book The Broken Dice by Ivar Ekeland gives an extended account of how the method was invented by a Franciscan friar known only as Brother Edvin sometime between 1240 and 1250.[3] Supposedly, the manuscript is now lost, but Jorge Luis Borges sent Ekeland a copy that he made at the Vatican Library.

Modifying the middle-square algorithm with a Weyl sequence improves period and randomness.[4][5]

Source : You are not allowed to view links. Register or Login
You are not allowed to view links. Register or Login

tacettin

You are not allowed to view links. Register or Login

tacettin

#3


You are not allowed to view links. Register or Login
You are not allowed to view links. Register or Login

Document echo ' ';