Using Rule 30 to Generate Pseudorandom Real Numbers

Initializing live version
Download to Desktop

Requires a Wolfram Notebook System

Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.

The rule 30 cellular automaton can be used to generate pseudorandom numbers. This Demonstration looks at an oversimplified version of how the central column in the evolution of this automaton can be used to generate pseudorandom real numbers between 0 and 1.


An initial integer seed is chosen (controlled here by a slider), converted to base 2, and then converted to a string of light and dark squares (here 1s get converted to dark squares and 0s to light squares). These squares (shaded blue at the top) are padded on either side with a number of light squares, and rule 30 is evolved from this initial condition. The squares in the central column of this evolution can be regarded as the base-2 decimal expansion of a number between 0 and 1 (again, dark squares correspond to 1s and light squares to 0s). As the initial seed varies over a wide range of integers, the numbers produced by this algorithm appear to be distributed nearly uniformly over the unit interval. Among several differences between this demonstration and random number generators used in practice is that in the latter, the recording of the bits of the number generated does not begin with the first step in the evolution of the cellular automata but only after the cellular automata has been allowed to evolve for a while.


Contributed by: Chris Boucher (November 2007)
Open content licensed under CC BY-NC-SA




Feedback (field required)
Email (field required) Name
Occupation Organization
Note: Your message & contact information may be shared with the author of any specific Demonstration for which you give feedback.