middle_square


middle_square, an Octave code which implements the middle square algorithm for generating random integers. This is a very early method, attributed to von Neumann, which actually is deeply flawed, with short cycles.

Licensing:

The computer code and data files made available on this web page are distributed under the MIT license

Languages:

middle_square is available in a C version and a C++ version and a Fortran90 version and a MATLAB version and an Octave version and a Python version.

Related Data and Programs:

middle_square_test

collatz, a MATLAB code which computes and analyzes the Collatz or hailstone or 3n+1 sequence;

Reference:

  1. Brian Hayes,
    The Middle of the Square,
    08 August 2022,
    http://bit-player.org/

Source Code:


Last modified on 18 June 2023.