HP-UX Reference (11i v1 00/12) - 3 Library Functions A-M (vol 6)
__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man3/!!!intro.3c
________________________________________________________________
___ ___
d
drand48(3C) drand48(3C)
NAME
drand48(), erand48(), lrand48(), nrand48(), mrand48(), jrand48(), srand48(), seed48(), lcong48() - generate
uniformly distributed pseudo-random numbers
SYNOPSIS
#include <stdlib.h>
double drand48(void);
double erand48(unsigned short int xsubi[3]);
long int lrand48(void);
long int nrand48(unsigned short int xsubi[3]);
long int mrand48(void);
long int jrand48(unsigned short int xsubi[3]);
void srand48(long int seedval);
unsigned short int *seed48(unsigned short int seed16v[3]);
void lcong48(unsigned short int param[7]);
Obsolescent Interfaces
int drand48_r(struct drand48_data *dp, double *randval);
int erand48_r(
unsigned short int xsubi[3],
struct drand48_data *dp,
double *randval);
int lrand48_r(struct drand48_data *dp, long int *randval);
int nrand48_r(
unsigned short int xsubi[3],
struct drand48_data *dp,
long int *randval);
int mrand48_r(struct drand48_data *dp, long int *randval);
int jrand48_r(
unsigned short int xsubi[3],
struct drand48_data *dp,
long int *randval);
int srand48_r(long int seedval, struct drand48_data *dp);
int seed48_r(unsigned short int seed16v[3], struct drand48_data *dp);
int lcong48_r(unsigned short int param[7], struct drand48_data *dp);
DESCRIPTION
This family of functions generates pseudo-random numbers using the well-known linear congruential algo-
rithm and 48-bit integer arithmetic.
In the following description, the formal mathematical notation [low,high) indicates an interval including
low but not including high.
drand48() and erand48() return nonnegative double-precision floating-point values uniformly distri-
buted over the interval [0.0,1.0).
lrand48() and nrand48() return nonnegative long integers uniformly distributed over the interval
[0,2ˆ31).
mrand48() and jrand48() return signed long integers uniformly distributed over the interval
[−2ˆ31,2ˆ31).
srand48(), seed48(), and lcong48() are initialization entry points, one of which should be invoked
before either drand48(), lrand48(),ormrand48() is called. (Although it is not recommended
practice, constant default initializer values are supplied automatically if
drand48(), lrand48(),or
mrand48() is called without a prior call to an initialization entry point.)
erand48(), nrand48(),
Section 3−−160 − 1 − HP-UX Release 11i: December 2000
___
___