[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Random Number Question
- Subject: Random Number Question
- From: "Bryan Parkoff" <nospam@nospam.com>
- Date: Mon, 5 May 2008 20:16:29 -0500
- Newsgroups: comp.sys.apple2
- Organization: Road Runner High Speed Online http://www.rr.com
- Xref: g2news1.google.com comp.sys.apple2:34983
Hello folks,
Do you know how random number work? You use either Applesoft BASIC or
Integer BASIC. You use the function like RND(). Take a look at my example
here.
10 PRINT INT( RND( 10 ) * 10)
20 GET A$
30 GOTO 10
Apple II has chosen the random number of the range from 0 to 9 and print
each random number to the screen. How do Apple II know to guess random
number? Take a look at monitor routine $FD1B. $4E and $4F are the high
byte of random and low byte of random. It waits for the key to be pressed
while random number continues to increment. If key is pressed, random
number stops to increment before it is printed to the screen. Repeat the
procedure to increment random number while it waits for a key.
Do you know the alternative implementation rather than keyin? Do you
think to implement the clock to replace keyin? The random number stops to
increment each one second while clock reads one second and another. What do
you think?
--
Yours Truly,
Bryan Parkoff