Test Results: The LCG as Implemented by the Sinclair ZX81



Implementation

The Sinclair ZX81 was a home computer released in 1981. It was fairly substandard for the time, being an economy model that sold for one tenth the price of its competitors.

Its pseudo random number generator was a Linear Congruent Generator, set using the following values:

The use of such a small M value drastically limits this PRNG's period and possible range, which shows in the test results below.



Test Results

Period Length Test
SEEDNumber indicates how many results could be obtained before the generator fell into a loop.
113865536FAIL
6553565536FAIL
867530965537FAIL
1677721665537FAIL
12345678965537FAIL


Dice Roll Test
This generator produced an ideal distribution of outcomes.


Dartboard Test
SEEDMinimum of 6,000 darts placed needed to pass.
11386239PASS
655356192PASS
86753096225PASS
167772166196PASS
1234567896227PASS


Crush Test
SEED70% or higher required to pass.
1138101%PASS
65535101%PASS
8675309101%PASS
16777216101%PASS
123456789101%PASS


Plot Test
The striped pattern indicates a serious problem with this PRNG's design.


Example Output
62450306978554517911771618034418846113563146173605687154941890241447283602989013566344692930635303
263197889191612700350567794603282621382924227633337537383266725230572883676951956201463534
464601111347105594885158592395202034891609564972159077398704115967604831519164610976029622116649
35463876286264984024655387542942941150529541406281758222412821598519283448587642004193005760
38852303464776643526532115867910020306676304141151010737192369201652059408646952461535752044225873
399764910913177529439023057665016265362416442875438613393496274455874617934695948538358894732
272891510218595184225447153773922057946205823637341032627725484750305373404802062576401476193457534
5521912668326562440560950492712532764563580983198239392530950274941436052169572664632414625510440
621679472551044043411516160331552088399915023432015418675986033058545552840533265454313114569
4274960473134962921928778612405484181525073439783627633757414432806073903002823916242755120038928
36046165075843357107231943566253244611546457158698114456468264151508917620108342618063001648527690
4517745962393006394611823348185548132318645926027364033183486543457886160822655825814355514491926612
298641161619293523565014263861291451106318783159210142398173718436320370572679543589579361983245660
16650362195015727936094201077485617418756304975909140920543721468052482400438226489336551463886
732325003402635097546643658056557474812215122974191626094749046845244141337994459321623115042529
43973211991711138196466832783856277264812003961185135936462477073910149021657734590383816055819871
48585394146959632402441061325118593751861370152342849540015520343594186325764163244247101828860934
48071864648741588611858374435574552118422412237339624227096482412136582934660722138219991157416143
3113341254138855839454182430323246504228486393401409402121272299371709136696652574461135121326
339875869311070438801422418282604841432125557162764110829352358865212412361253522681627245124742453


A WFTID Website