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

  1. Newsgroups: comp.os.vms
  2. Path: sparky!uunet!elroy.jpl.nasa.gov!ames!kronos.arc.nasa.gov!butch!iscnvx!news
  3. From: marshall@NEBULA.SSD.LMSC.LOCKHEED.COM (Bob Marshall)
  4. Subject: Re: A random number
  5. Message-ID: <1993Jan21.205830.26425@iscnvx.lmsc.lockheed.com>
  6. Sender: news@iscnvx.lmsc.lockheed.com (News)
  7. Reply-To: marshall@NEBULA.SSD.LMSC.LOCKHEED.COM
  8. Organization: LMSC, Sunnyvale, California
  9. References: <1993Jan21.041813.20307@ccu1.aukuni.ac.nz>
  10. Date: Thu, 21 Jan 93 20:58:30 GMT
  11. Lines: 22
  12.  
  13. In article <1993Jan21.041813.20307@ccu1.aukuni.ac.nz>, sands@ccu1.aukuni.ac.nz (Greg Sands) 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?  I had a look in
  16. >the manual, but didn't really even know where to start looking, so even a
  17. >pointer in that direction would be helpful.  Thanks.
  18.  
  19. You can get a pretty good one by doing something like this :
  20.  
  21.   $ X = F$INT(F$EXT(21,2,F$TIME())) + 100*F$INT(F$EXT(19,1,F$TIME()))
  22.  
  23. It all depends on how often you plan to do this. If you call for such a
  24. random number frequently within a span of a few seconds or so, this will
  25. not generate a very good series of random numbers. But you just asked for
  26. one random number in your question, and for a one-shot deal, this works fine.
  27.  
  28. =============================================================================
  29. Bob Marshall                     \\     "Women aren't as smart as they
  30. Lockheed Missiles & Space Co.     \\     think they are; they think we
  31. Sunnyvale, CA                      \\    men know a lot more than we
  32. marshall@force.ssd.lmsc.lockheed.com\\   really do."
  33. "I tell the truth 'cept when I lie"  \\     - Tim the Toolman
  34. =============================================================================
  35.