User Tools

Site Tools


base:comparison_of_6502_random_generators

This is an old revision of the document!


Comparison of 6502 pseudo random generators

This is an overview of the main properties of eight algorithms here on codebase.

Each algorithm was implemented as stated in the linked articles. Code size, execution time was measured. Execution time includes the JSR/RTS commands. Many PRNGs have a problem when the internal state becomes 0. Since this might be an important feature, it was stated which algorithms can also eventually output and handle a 0.

The quality was assessed by a test if the low byte hits all 256 numbers for 2000 random numbers and by a graphical check of the plot of 51200 random values. In every line n, the n&7-th bit of the result was plotted. For the results annotated with high quality, I could not identify any patterns in the plot. For good quality, some slight patterns or imbalances were visible. For low quality a direct repetition of values was visible.

result size execution cycles size (bytes) seed=0 quality plot
798 Xorshift 16bit 42 21 stuck high
X ABC 16bit 50 28 handled high
Whiteflame16 16bit 42* 35 handled medium (some horizontal dashes visible)
Galois LFSR 32bit 78 50 stuck medium (too many 0s)
Two16 PRG LSFR 16bit 120 66 stuck high
another 16bit PRG 16bit 42 21 stuck low
16bit PRG 16bit 81 49 stuck low
Whiteflame8 8bit 28* 14 handled low

* implementation has branches, execution time varies

base/comparison_of_6502_random_generators.1636679544.txt.gz · Last modified: 2021-11-12 02:12 by wil