User Tools

Site Tools


base:32bit_galois_lfsr

32 bit Galois LFSR random generator

A fast random generator based on the CRC32 algorythm.

It uses the CRC32 IEEE 802.3 polynom $04C11DB7 which produces a random number period of 2^32-1 (4.3 billion) numbers.

rnd:
        ASL random
        ROL random+1
        ROL random+2
        ROL random+3
        BCC .nofeedback
        LDA random
        EOR #$B7
        STA random
        LDA random+1
        EOR #$1D
        STA random+1
        LDA random+2
        EOR #$C1
        STA random+2
        LDA random+3
        EOR #$04
        STA random+3
.nofeedback:
        RTS

random: .BYTE $FF,$FF,$FF,$FF
base/32bit_galois_lfsr.txt · Last modified: 2015-04-17 04:30 (external edit)