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
SEED | Number indicates how many results could be obtained before the generator fell into a loop. |
1138 | 65536 | FAIL |
65535 | 65536 | FAIL |
8675309 | 65537 | FAIL |
16777216 | 65537 | FAIL |
123456789 | 65537 | FAIL |
|
This generator produced an ideal distribution of outcomes. |
SEED | Minimum of 6,000 darts placed needed to pass. |
1138 | 6239 | PASS |
65535 | 6192 | PASS |
8675309 | 6225 | PASS |
16777216 | 6196 | PASS |
123456789 | 6227 | PASS |
SEED | 70% or higher required to pass. |
1138 | 101% | PASS |
65535 | 101% | PASS |
8675309 | 101% | PASS |
16777216 | 101% | PASS |
123456789 | 101% | PASS |
|
The striped pattern indicates a serious problem with this PRNG's design. |
62450 | 30697 | 8554 | 51791 | 17716 | 18034 | 41884 | 61135 | 63146 | 17360 | 56871 | 5494 | 18902 | 41447 | 28360 | 29890 | 13566 | 34469 | 29306 | 35303 |
26319 | 7889 | 1916 | 12700 | 35056 | 7794 | 60328 | 2621 | 38 | 2924 | 22763 | 3337 | 53738 | 32667 | 25230 | 57288 | 36769 | 5195 | 62014 | 63534 |
46460 | 11113 | 47105 | 59488 | 5158 | 59239 | 52020 | 34891 | 60956 | 49721 | 59077 | 39870 | 41159 | 6760 | 48315 | 19164 | 61097 | 60296 | 221 | 16649 |
3546 | 3876 | 28626 | 49840 | 2465 | 53875 | 42942 | 9411 | 50529 | 54140 | 62817 | 58222 | 41282 | 15985 | 19283 | 4485 | 8764 | 2004 | 19300 | 5760 |
38852 | 30346 | 47766 | 43526 | 53211 | 58679 | 10020 | 30667 | 6304 | 14115 | 10107 | 37192 | 36920 | 16520 | 59408 | 64695 | 2461 | 53575 | 20442 | 25873 |
39976 | 49109 | 13177 | 5294 | 3902 | 30576 | 65016 | 26536 | 24164 | 42875 | 4386 | 1339 | 34962 | 744 | 55874 | 61793 | 46959 | 48538 | 35889 | 4732 |
27289 | 15102 | 18595 | 18422 | 5447 | 15377 | 39220 | 57946 | 20582 | 36373 | 41032 | 62772 | 54847 | 50305 | 37340 | 48020 | 62576 | 40147 | 61934 | 57534 |
55219 | 12668 | 32656 | 24405 | 60950 | 49271 | 25327 | 64563 | 58098 | 31982 | 39392 | 5309 | 5027 | 49414 | 36052 | 16957 | 26646 | 32414 | 6255 | 10440 |
62167 | 9472 | 55104 | 4043 | 41151 | 6160 | 3315 | 52088 | 39991 | 50234 | 32015 | 41867 | 59860 | 33058 | 54555 | 28405 | 33265 | 4543 | 13114 | 569 |
42749 | 60473 | 13496 | 29219 | 28778 | 61240 | 5484 | 18152 | 50734 | 3978 | 36276 | 33757 | 41443 | 28060 | 7390 | 30028 | 23916 | 24275 | 51200 | 38928 |
36046 | 16507 | 58433 | 57107 | 23194 | 35662 | 53244 | 61154 | 64571 | 58698 | 11445 | 6468 | 26415 | 15089 | 17620 | 10834 | 26180 | 63001 | 6485 | 27690 |
45177 | 45962 | 39300 | 63946 | 11823 | 34818 | 55481 | 32318 | 64592 | 60273 | 64033 | 18348 | 65434 | 57886 | 16082 | 26558 | 25814 | 35551 | 44919 | 26612 |
29864 | 11616 | 19293 | 5235 | 65014 | 26386 | 12914 | 51106 | 31878 | 31592 | 10142 | 39817 | 37184 | 36320 | 37057 | 26795 | 43589 | 57936 | 19832 | 45660 |
16650 | 3621 | 9501 | 57279 | 36094 | 20107 | 748 | 56174 | 18756 | 30497 | 59091 | 40920 | 54372 | 14680 | 52482 | 4004 | 38226 | 48933 | 65514 | 63886 |
7323 | 25003 | 40263 | 5097 | 54664 | 36580 | 56557 | 47481 | 22151 | 22974 | 19162 | 60947 | 49046 | 8452 | 44141 | 33799 | 44593 | 2162 | 31150 | 42529 |
43973 | 21199 | 17111 | 38196 | 46683 | 27838 | 56277 | 26481 | 20039 | 61185 | 1359 | 36462 | 47707 | 39101 | 49021 | 6577 | 34590 | 38381 | 60558 | 19871 |
48585 | 39414 | 6959 | 63240 | 24410 | 61325 | 11859 | 37518 | 61370 | 15234 | 28495 | 40015 | 52034 | 35941 | 8632 | 57641 | 63244 | 24710 | 18288 | 60934 |
48071 | 864 | 64874 | 15886 | 11858 | 37443 | 55745 | 52118 | 42241 | 22373 | 39624 | 22709 | 64824 | 12136 | 58293 | 46607 | 22138 | 21999 | 11574 | 16143 |
31133 | 41254 | 13885 | 58394 | 54182 | 430 | 32324 | 65042 | 28486 | 39340 | 1409 | 40212 | 1272 | 29937 | 17091 | 36696 | 65257 | 44611 | 3512 | 1326 |
33987 | 58693 | 11070 | 43880 | 14224 | 18282 | 60484 | 14321 | 25557 | 16276 | 41108 | 2935 | 23588 | 65212 | 41236 | 12535 | 22681 | 62724 | 51247 | 42453 |