home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / sys / apple2 / 20165 < prev    next >
Encoding:
Text File  |  1992-09-11  |  1.3 KB  |  43 lines

  1. Newsgroups: comp.sys.apple2
  2. Path: sparky!uunet!newsstand.cit.cornell.edu!piccolo.cit.cornell.edu!crux3!jmk3
  3. From: jmk3@crux3.cit.cornell.edu (Jay Krell)
  4. Subject: random numbers/time
  5. Message-ID: <jmk3.716243933@crux1.cit.cornell.edu>
  6. Sender: news@piccolo.cit.cornell.edu (USENET News System)
  7. Nntp-Posting-Host: crux3.cit.cornell.edu
  8. Organization: Cornell Information Technologies
  9. Date: 11 Sep 92 20:38:53 GMT
  10. Lines: 31
  11.  
  12. :edit
  13. >>1) Time.  How do you get the time in Apple IIe BASIC?  Is it returned
  14. >> as a string or a number?
  15.  
  16. >>2) Random numbers.  How do you get a random number from 0 to n?
  17.  
  18.  
  19. Applesoft BASIC cannot read the clock. It doesn't take much work to get
  20. it from the toolbox, though.
  21.  
  22. random = int(rnd(1)*10)+1 will set random to an integer 1-10
  23.  
  24. rnd(n) returns a random num 0-1 if n=0 I think you get the same number
  25. over and over, just use n=1. Multiply it by the number of numbers in
  26. your range, take the integer, and add the first number in the range.
  27.  
  28. If you need exact code to get the time in an ASCII string or in hex,
  29. email me and I'll dig up the info and write the code.
  30.  
  31.  
  32. Jay (new here)
  33.  
  34. PS - Now I see you're using a //e. You can get the time from ProDOS but I
  35. don't know how and don't have the info. The "toolbox" I refer to is on the IIGS.
  36. :write
  37.  
  38. q
  39. Q
  40. :q
  41. :quit
  42.  
  43.