HP C/iX Library Reference Manual (30026-90004)
286 Chapter5
HP C/iX Library Function Descriptions
rand48
rand48
The drand48, erand48, lrand48, nrand48, mrand48, jrand48, srand48, seed48, and
lcong48 functions generate uniformly distributed pseudo-random numbers.
Syntax
double drand48 ( )
double erand48 (
xsubi
)
unsigned short
xsubi
[3];
long lrand48 ( )
long nrand48 (
xsubi
)
unsigned short
xsubi
[3];
long mrand48 ( )
long jrand48 (
xsubi
)
unsigned short
xsubi
[3];
void srand48 (
seedval
)
long
seedval
;
unsigned short *seed48 (
seed16v
)
unsigned short
seed16v
[3];
void lcong48 (
param
)
unsigned short
param
[7];
Parameters
xsubi
A pointer to a 3-word (48-bit) unsigned short int array used by the
random number generator to store successive values of X.
seedval
A 32-bit seed value used to initialize the high-order bits of seed value to
the random number generator
seed16v
A pointer to a 3-word (48-bit) unsigned short int array used internally
by the random number generator to hold the previous value of the seed.
param
A pointer to a 7-word unsigned short int array arranged as follows:
param[0-2] The 48-bit seed value.
param[3-5] The multiplier A used to expand the random number from
the 0 to 1 range to the desire range.
param[6] The addend C used to shift the random number from the 0
to 1 range to the desired range.