home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / os / vms / 21621 < prev    next >
Encoding:
Text File  |  1993-01-21  |  1.2 KB  |  33 lines

  1. Newsgroups: comp.os.vms
  2. Path: sparky!uunet!noc.near.net!ileaf!leafusa!bcking
  3. From: bcking@HQ.Ileaf.COM (Christine King)
  4. Subject: Re: A random number
  5. Message-ID: <C17pFH.3LC@HQ.Ileaf.COM>
  6. Sender: usenet@HQ.Ileaf.COM
  7. Nntp-Posting-Host: natasha
  8. Organization: Interleaf, Inc.
  9. References: <1993Jan21.041813.20307@ccu1.aukuni.ac.nz>
  10. Date: Thu, 21 Jan 1993 16:21:16 GMT
  11. Lines: 20
  12.  
  13. In article <1993Jan21.041813.20307@ccu1.aukuni.ac.nz> g.sands@aukuni.ac.nz writes:
  14. >Is there an easy way to get a scaled random number into a DCL com file? 
  15. >Say an integer between 0 and 1000 or something like that?
  16.  
  17. You could use F$TIME() to get a fairly random looking number.  How
  18. about this:
  19.  
  20.     $ rno = f$element(1,".",f$time())   !..random 00-99
  21.  
  22. This gives you the hundredths part of "21-JAN-1993 11:04:20.66".  If
  23. you want another digit, pick the lower digit out of the seconds.
  24. Remember that the hours:minutes:seconds don't give you a full range of
  25. decimal numbers.
  26.  
  27. Hope this helps.
  28. -- 
  29.  Christine King, bcking@ileaf.com
  30.  Interleaf, Inc.      | My opinions are not  | "Time is like that,
  31.  9 Hillside Avenue    | necessarily those of |  except for the cannon
  32.  Waltham MA 02154 USA | Interleaf, Inc.      |  and the donut." -Dilbert
  33.