HP C/iX Library Reference Manual (30026-90004)

288 Chapter5
HP C/iX Library Function Descriptions
rand48
times the functions have been called to generate numbers for the other streams.
The initializer function srand48 sets the high-order 32 bits of
X
i
to the 32 bits contained in
its argument. The low-order 16 bits of
X
i
are set to the arbitrary value 330E
16
.
The initializer function seed48 sets the value of
X
i
to the 48-bit value specified in the
argument array. In addition, the previous value of
X
i
is copied into a 48-bit internal buffer,
used only by seed48, and a pointer to this buffer is the value returned by seed48. This
returned pointer, which can be ignored if not needed, is useful if a program is to be
restarted from a given point at some future time. Use the pointer to get at and store the
last
X
i
value, and then use this value to reinitialize using seed48 when the program is
restarted.
The initialization function lcong48 allows the user to specify the initial
X
i
, the multiplier
value
a
, and the addend value
c
. Argument array elements
param[0-2]
specify
X
i
,
param[3-5]
specify the multiplier
a
, and
param[6]
specifies the 16-bit addend c. After
lcong48 is called, a subsequent call to either srand48 or seed48 restores the standard
multiplier and addend values
a
and
c
, as specified previously.
See Also
rand()