Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!spool2.mu.edu!think.com!mintaka!dcw From: dcw@lcs.mit.edu (David C. Whitney) Newsgroups: comp.sys.apple2 Subject: Re: random no. in assembly? Message-ID: <1991Jan30.125552.5794@mintaka.lcs.mit.edu> Date: 30 Jan 91 12:55:52 GMT References: <9101300829.AA21626@apple.com> Sender: daemon@mintaka.lcs.mit.edu (Lucifer Maleficius) Organization: MIT Spoken Language Systems Group Lines: 18 In article <9101300829.AA21626@apple.com> C489030@UMCVMB.MISSOURI.EDU (Greg Hodgdon) writes: >Hi all. I am looking for a way to generate random numbers in an assembly >language program. The entry point to the applesoft RND function would >be a start, but I really just need an algorithm. I'm using one that >shifts a 2-byte seed left once and adds it back to the seed. that doesn't >give very good results after the first few numbers. I wrote a simple one that basically does a CRC-16 (I can send you a 6502 CRC-16 calculator) on values grabbed from somewhere on page $C0 (something like $C022 or something). These softswitches usually have random changing garbage in them, so they supply numbers about as random as you can get. -- Dave Whitney Computer Science MIT 1990 | I wrote Z-Link and BinSCII. Send me bug dcw@lcs.mit.edu dcw@mit.edu | reports. I have a job. Don't send me offers. "The price of freedom is eternal vigilance" --Binky (aka Matt Groening)