home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.apple2
- Path: sparky!uunet!newsstand.cit.cornell.edu!piccolo.cit.cornell.edu!crux3!jmk3
- From: jmk3@crux3.cit.cornell.edu (Jay Krell)
- Subject: random numbers/time
- Message-ID: <jmk3.716243933@crux1.cit.cornell.edu>
- Sender: news@piccolo.cit.cornell.edu (USENET News System)
- Nntp-Posting-Host: crux3.cit.cornell.edu
- Organization: Cornell Information Technologies
- Date: 11 Sep 92 20:38:53 GMT
- Lines: 31
-
- :edit
- >>1) Time. How do you get the time in Apple IIe BASIC? Is it returned
- >> as a string or a number?
-
- >>2) Random numbers. How do you get a random number from 0 to n?
-
-
- Applesoft BASIC cannot read the clock. It doesn't take much work to get
- it from the toolbox, though.
-
- random = int(rnd(1)*10)+1 will set random to an integer 1-10
-
- rnd(n) returns a random num 0-1 if n=0 I think you get the same number
- over and over, just use n=1. Multiply it by the number of numbers in
- your range, take the integer, and add the first number in the range.
-
- If you need exact code to get the time in an ASCII string or in hex,
- email me and I'll dig up the info and write the code.
-
-
- Jay (new here)
-
- PS - Now I see you're using a //e. You can get the time from ProDOS but I
- don't know how and don't have the info. The "toolbox" I refer to is on the IIGS.
- :write
-
- q
- Q
- :q
- :quit
-
-