Subject: Re: [stella] entropy & randomness From: "Eric Ball/Markham/IBM" <eball@xxxxxxxxxx> Date: Tue, 9 Oct 2001 12:56:05 -0400 |
Have to wade in with my own C$0.03: I have created the following 8 bit PRNG based on http://www-2.cs.cmu.edu/~koopman/lfsr/ LDA RAND BEQ XSEED LSR BCC SRAND XSEED: EOR #$A9 SRAND: STA RAND Note: The webpage gives the XOR terms for a left shift LFSR, but since the 6502 only has ASL, I've flipped the bits of the term around. You should also be careful if you use RAND rather than just the carry bit because there are a couple of sequences where X(n+1) = X(n). For experimentation, here is the LFSR in Basic: FOR x = 0 TO 255 IF r <= 0 OR r > 255 THEN r = 169 ELSEIF r >= 128 THEN r = (r * 2) XOR (256 + 169) ELSE r = r * 2 END IF PRINT r, NEXT x - Archives (includes files) at http://www.biglist.com/lists/stella/archives/ Unsub & more at http://www.biglist.com/lists/stella/
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [stella] entropy & randomness, Kevin Horton | Thread | Re: [stella] entropy & randomness, Eric Ball/Markham/IB |
Re: [stella] entropy & randomness, Eckhard Stolberg | Date | Re: [stella] entropy & randomness, Eric Ball/Markham/IB |
Month |