Re: 8 Bit Random Numbers





Bill Bowden wrote:

That's interesting John. I changed your tap sequence to what I had
from the other program so the xor sequence is:

tap1 = q5 XOR q6
tap2 = q4 XOR tap1
tap3 = tap2 XOR q8
srin = nor XOR tap3

This seems to represent what I had earlier with bits 5,6 exored, and
that result xored with bit 3, and that result xored with bit 8.

Worked well and produced the expected results with the addition of the
zero lockup state on count 25.

Not sure how the zero gets eliminated, but the sequence continued with
the correct values after the zero state.

I'll give it some more though and maybe figure it out.

Nice job. Some people say it's impossible to eliminate the zero lockup
state, but looks like that's not the case.

IIRC, you can eliminate the zero lockup state, but only by introducing
some other state that locks up. What you cannot do is make an XOR-based
PRNG that pseudorandomly cycles through all values from 0 to 255.

If you are using a PC or microcontroller rather than logic gates,
the RC4/ARCFOUR algorithm is a good alternative to an XOR-based
PRNG, is far, far more difficult to predict, and does not cycle
unless you are willing to wait many millions of years.


.


Loading