|
VMS Help CRTL, nrand48, Description *Conan The Librarian |
The nrand48 function generates pseudorandom numbers using the
linear congruential algorithm and 48-bit integer arithmetic.
The nrand48 function returns nonnegative, long integers uniformly
distributed over the range of y values, such that 0
The function works by generating a sequence of 48-bit integer
values, Xi, according to the linear congruential formula:
Xn+1 = (aXn+c)mod m n >= 0
The argument m equals 248, so 48-bit integer arithmetic is
performed. Unless you invoke the lcong48 function, the multiplier
value a and the addend value c are:
a = 5DEECE66D16 = 2736731631558
c = B16 = 138
The nrand48 function requires that the calling program pass an
array as the xsubi argument, which for the first call must be
initialized to the initial value of the pseudorandom-number
sequence. Unlike the drand48 function, it is not necessary to
call an initialization function prior to the first call.
By using different arguments, the nrand48 function allows
separate modules of a large program to generate several
independent sequences of pseudorandom numbers. For example, the
sequence of numbers that one module generates does not depend
upon how many times the functions are called by other modules.
|
|