ZX Spectrum RND Generator

The ZX Spectrum's RND function does not generate truly random numbers. It uses a pseudo-random sequence, meaning that the same starting point will always produce the same sequence.

RANDOMIZE sets the starting point for this sequence. RANDOMIZE 0, or simply RANDOMIZE with no argument, is different: the Spectrum uses the current value of the FRAMES system variable as the starting point.

For this calculator we use a non-zero RANDOMIZE value so that the sequence can be reproduced exactly.

RANDOMIZE Calculator

Enter a non-zero RANDOMIZE value and generate the next value in the ZX Spectrum's pseudo-random sequence.

How the sequence works

The calculator uses the same basic calculation used by the ZX Spectrum to produce its pseudo-random sequence:

Next value = (75 × (current value + 1) − 1) ÷ 65536

Each time Next RND is pressed, the newly generated internal value becomes the starting value for the following calculation.

RANDOMIZE 0 is not used as a fixed seed here. On a real ZX Spectrum, RANDOMIZE 0 uses the current FRAMES value, which changes as the computer runs.