HP3000-L Archives

October 1997, Week 3

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Steve Dirickson b894 WestWin <[log in to unmask]>
Reply To:
Steve Dirickson b894 WestWin <[log in to unmask]>
Date:
Tue, 21 Oct 1997 18:25:00 P
Content-Type:
text/plain
Parts/Attachments:
text/plain (45 lines)
<<If the function/intrinsic indicated by Steve bears any resemblance to
their
counterparts in the CM world of the HP3000 then let me elaborate a bit.

There exists a function, RAND, that typically is used to get a 'seed'
number
for the random number generator intrinsic.  The returned data if a
floating
point type,>>


Yup, dat's da one.

<<a bit hard to represent in COBOL.>>


Really? COBOL doesn't do "real"/floating point? If it doesn't, you could
wrap the RAND() call into another function in C or Pascal to do something
like produce a list (probably in a file) of "n" pseudorandom integers
between specified minimum and maximum values.

<<There also exists an intrinsic, RAND1(seed#) that also returns a
floating point value 0.0<=x<=1.0.>>


Actually, you (generally) use both; call RAND1 with some arbitrary value,
like the return value from the TIMER intrinsic, to initialize the
pseudorandom sequence, then call RAND to get the next value in the
sequence. If RAND1 isn't called (or is called with the same seed value
for each run), the pseudorandom sequence will be the same for each run.
At least that's what I recall, but can't check-sorry.

<<Perhaps something similar can be used if you keep the employee names in
a flat file, or an image detail dataset and use the file's EOF along with
the random number to perform a directed read/get. Selected entries are
flagged so that they would not be picked again....etc,>>


Another approach is to put the values (or pointers, record numbers, or
other link to the value) into a file, with a pseudorandom number attached
to each record. Sort the file by the pseudorandom numbers, then read out
as many as you need.

Steve

ATOM RSS1 RSS2