Path: csiph.com!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Duhast Newsgroups: comp.sys.apple2.programmer Subject: Linear Feedback Shift Register Date: Wed, 4 Sep 2024 21:39:53 -0400 Organization: A noiseless patient Spider Lines: 35 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 05 Sep 2024 03:40:34 +0200 (CEST) Injection-Info: dont-email.me; posting-host="1199f4eb944397c7df32b963e1acfc46"; logging-data="62944"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19wdaf+NWgV6unDuNUDLJos" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:gFqpyiyhhCuIvEIJiTISmcjLzlY= Content-Language: en-US Xref: csiph.com comp.sys.apple2.programmer:6314 I'm trying to generate pseudo random numbers 1-255(yes zero is a special case). Following Graphic Gems, and code I found at codebase64 I came up with this: ORG $300 LDY #$00 XOR LSR RAND LDA RAND BCC SKIP EOR #$B8 SKIP STA RAND STA $2000,Y INY BEQ DONE JMP XOR DONE RTS RAND DB $01 I then put the values in text file: 10 D$ = CHR$ (4) 20 PRINT D$;"OPEN RAND" 30 PRINT D$;"WRITE RAND" 40 FOR I = 0 TO 255 50 PRINT PEEK (8196 + I) 60 NEXT 70 PRINT D$;"CLOSE" Pasted them into a spreadsheet and sorted. It doesn't work. There are missing numbers, duplicate numbers. What am I doing wrong? Is there a better method?