DataLoader/MX Reference Manual (G06.24+)
Creating a Customized Version of DataLoader/MX
DataLoader/MX Reference Manual—525872-002
5-28
Generating Test Data
because of their repeatability. From now on, the word random is used to mean pseudo-
random.
DataLoader/MX provides two random-number-generating procedures. Each call to
either procedure returns a random unsigned 32-bit number. Values are evenly
distributed over the range of an unsigned 32-bit number (0 through 4,294,967,295).
The two procedures differ in the number of values they return before repeating (known
as the period).
The results of a call to either procedure are directly usable as is, but it is more typical
to want to generate a random number in a more constrained range, such as a salary
evenly distributed from 20,000 through 80,000. To transform the result of, for example,
DTLRandUnsignedLong2 to a more useful range, take the result of
DTLRandUnsignedLong2 modulo, the range of your desired distribution, and add that
to the minimum value of the desired range. The C statement that would perform this
transformation for this salary range is:
Salary = (DTLRandUnsignedLong2() % 60001 ) + 20000;
The distribution of the numbers returned by either procedure is an even distribution.
Simple transformations like the one shown previously are also likely to produce even
distributions. There are, however, other useful distributions, most notably the Normal
distribution, which can be generated from an even distribution.
DTLRandUnsignedLong
This procedure returns the next unsigned 32-bit number from a pseudo-random series
with a period of 1,073,741,824.
The syntax is:
The algorithm used is the multiplicative congruential random-number generator with a
seed value of 1, described in Modern Statistical, Systems, and GPSS Simulation by
Zaven A. Karian and Edward J. Dudewicz, W. H. Freeman & Co., October 1990, page
90.
DTLRandUnsignedLong2
This procedure returns the next unsigned 32-bit number from a random series with a
period of about 2**47. DTLRandUnsignedLong2 has a number of advantages over
DTLRandUnsignedLog and is recommended.
The syntax is:
The algorithm used is the Lagged Fibonacci Generator (17,5,31) after Marsaglia with a
LCG initialization method after Park and Miller.
unsigned long DTLRandUnsignedLong( void );
unsigned long DTLRandUnsignedLong2( void );