home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.os.vms
- Path: sparky!uunet!elroy.jpl.nasa.gov!ames!kronos.arc.nasa.gov!butch!iscnvx!news
- From: marshall@NEBULA.SSD.LMSC.LOCKHEED.COM (Bob Marshall)
- Subject: Re: A random number
- Message-ID: <1993Jan21.205830.26425@iscnvx.lmsc.lockheed.com>
- Sender: news@iscnvx.lmsc.lockheed.com (News)
- Reply-To: marshall@NEBULA.SSD.LMSC.LOCKHEED.COM
- Organization: LMSC, Sunnyvale, California
- References: <1993Jan21.041813.20307@ccu1.aukuni.ac.nz>
- Date: Thu, 21 Jan 93 20:58:30 GMT
- Lines: 22
-
- In article <1993Jan21.041813.20307@ccu1.aukuni.ac.nz>, sands@ccu1.aukuni.ac.nz (Greg Sands) writes:
- >Is there an easy way to get a scaled random number into a DCL com file?
- >Say an integer between 0 and 1000 or something like that? I had a look in
- >the manual, but didn't really even know where to start looking, so even a
- >pointer in that direction would be helpful. Thanks.
-
- You can get a pretty good one by doing something like this :
-
- $ X = F$INT(F$EXT(21,2,F$TIME())) + 100*F$INT(F$EXT(19,1,F$TIME()))
-
- It all depends on how often you plan to do this. If you call for such a
- random number frequently within a span of a few seconds or so, this will
- not generate a very good series of random numbers. But you just asked for
- one random number in your question, and for a one-shot deal, this works fine.
-
- =============================================================================
- Bob Marshall \\ "Women aren't as smart as they
- Lockheed Missiles & Space Co. \\ think they are; they think we
- Sunnyvale, CA \\ men know a lot more than we
- marshall@force.ssd.lmsc.lockheed.com\\ really do."
- "I tell the truth 'cept when I lie" \\ - Tim the Toolman
- =============================================================================
-