[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Where does the Applesoft RND() function get its data?



On Feb 25, 10:48 am, "Jayson Smith"
<ihatespamratguynospample...@insightbb.spamsucks.com> wrote:
> I'm just wondering where the Applesoft RND() function gets its numbers. Is
> there a spot in memory that contains random values, or a machine language
> routine, or what?

Just by memory - I think the subroutine that produces pseudo-random
numbers uses entropy from a counter incremented by the KEYIN loop.

If you need more details, I can look it up for you. Or some of the
encyclopedic fellows on this list could cite it by heart. ;-)

And, no, there is no I/O location that gives random values. You either
read whatever device drives the bus, or the remnants of the last
scanned video byte. Almost 20 years ago I did a LORES maze generator
in 6502 assembly and needed some "random" source. I used $C030 as it
both produced some noise and resulted in seemingly-random mazes. But
they weren't - just the relation was too complex. :-)