Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
lcong48(3) OSS Library Calls Reference Manual
NAME
lcong48 - Sets rule to generate uniformly distributed pseudorandom number sequences
LIBRARY
G-series native Guardian processes: $SYSTEM.SYSnn.ZCRTLSRL
G-series native OSS processes: /G/system/sysnn/zcrtlsrl
H-series and J-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCRTLDLL
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zcrtldll
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/ycrtldll
SYNOPSIS
#include <stdlib.h>
void lcong48(
unsigned short param[7]);
PARAMETERS
param Specifies an array that in turn specifies the initial X
i
, the multiplier value a, and
the addend value c.
DESCRIPTION
The lcong48( ) function initializes the random-number generator. Programs should invoke it
before calling the drand48( ), lrand48( ),ormrand48( ) functions. (Although it is not recom-
mended practice, constant default initializer values are supplied automatically if the drand48( ),
lrand48( ),ormrand48( ) functions are called without first calling an initialization function.)
The erand48( ), nrand48( ), and jrand48( ) functions do not require that an initialization function
be called first.
All the functions work by generating a sequence of 48-bit integer values, X
i
, according to the
linear congruential formula:
X
n+1
= (aX
n
+c)
mod m
n ≥ 0
The value of m equals 2 to the power 48; hence 48-bit integer arithmetic is performed. Unless
lcong48( ) has been invoked, the multiplier value a and the addend value c are given by
a = 5DEECE66D
16
= 273673163155
8
c = B
16
= 13
8
The lcong48( ) function specifies the initial X
i
value, the multiplier value a, and the addend value
c. The param 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( ) has been called, a subsequent call to
either srand48( ) or seed48( ) restores the standard a and c values as specified previously.
NOTES
This function supports both IEEE Std 754-1985 floating-point and Tandem floating-point values
in the native environment. IEEE values can include NaN and infinity, and the sign of 0.0 (zero)
can be either positive or negative. Refer to the fp_class(3) reference page for a description of
IEEE value classes.
Guardian functions are available to convert between floating-point formats. Refer to the Guar-
dian Programmer’s Guide for a discussion of floating-point conversions.
RETURN VALUES
The lcong48( ) function does not return a value.
4−82 Hewlett-Packard Company 527187-017