A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value....

140
A PORTABLE C RANDOM NUMBER GENERATOR by Anthony Wayne Crunk Project Report submitted to the Faculty of the Virginia Polytechnic Institute‘and State University in partial fulfillment of the requirements for the degree of MASTER OF SCIENCE in _ Computer Science and Applications . APPROVED: Osman Balci Richard E. Nance Dennis G. Kafura James D. Arthur May, 1985 Blacksburg, Virginia

Transcript of A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value....

Page 1: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

A PORTABLE C RANDOM NUMBER GENERATOR

by

Anthony Wayne Crunk

Project Report submitted to the Faculty of the

Virginia Polytechnic Institute‘and State University

in partial fulfillment of the requirements for the degree of

MASTER OF SCIENCE

in _

Computer Science and Applications .

APPROVED:

Osman Balci

Richard E. Nance Dennis G. Kafura

James D. Arthur

May, 1985Blacksburg, Virginia

Page 2: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

A PORTABLE C RANDOM NUMBER GENERATOR

A by

Anthony Wayne Crunk

Committee Chairman: Osman BalciComputer Science and Applications

(ABSTRACT)

Proliferation of computers with varying word sizes has led

to increases in software use where random number generation

is required. Several techniques have been developed.

Criteria of randomness, portability, period, reproducibili-

Ity, variety, speed, and storage are used to evaluate devel-

oped generation methods. The Tausworthe method is the only

method to meet the portability requirement, and is chosen to

be implemented. A C language implementation is proposed as

a possible implementation and test results are presented to

confirm the acceptability of the proposed code.

CR CATEGORIES AND SUBJECT DESCRIPTORS: G.3 [MATHEMATICSOF COMPUTING]: Probability and Statistics - Randmn NumberGeneraüon ; I.6.0 [SIMULATION AND MODELING]: General

GENERAL TERMS: AlgorithmsADDITIONAL KEY WORDS AND PHRASES: pseudorandom numbers,

» simulation, Tausworthe method, testing of random number gen-erators

Page 3: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

ACKNOWLEDGEMENTS

I would like to thank Dr. Osman Balci for his guidance and

assistance during the preparation of this report.

I would also like to thank R. O. Bruno for his infinite pa-

tience while this report was developed, W. A. Best for his

proofreading of this document, and members of the "cheering

section" who are too numerous to mention by name.

iii

Page 4: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

TABLE OF CONTENTS

ACKNOWLEDGEMENTS iii

Chapterpage

I. INTRODUCTION ................... 1

II. REVIEW OF RANDOM NUMBER GENERATION TECHNIQUES . . . 4

Mid-Square Method ............... 4Congruential Methods .............. 5Additive Method ................·6‘ Combinational Methods ............. 7Tausworthe Method ............... 8Choice of Method ................ 9

III. PROPOSED RANDOM NUMBER GENERATOR ......... 11

Algorithm ................... 11Implementation ................. 14

IV. THEORETICAL TESTS AND RESULTS ........... 24

V. EMPIRICAL TESTS AND RESULTS ............ 27

VI. CONCLUSIONS .................... 32

REFERENCES ........................ 33

Appendix

A. RESULTS OF THE RANDOM NUMBER GENERATOR TESTINGPACKAGE ................... 35

iv

Page 5: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

Chapter I

INTRODUCTIONI

Various disciplines find occasion for the use of ran-

domly selected numbers. Knuth [3] and others have indicated

several including: l) simulation, 2) sampling, 3) numeri-

cal analysis, 4) program testing, 5) decision support sys-

tems, and 6) entertainment. The accelerating infusion of

computers into wider arenas of business and industry has in-

creased the use of pseudorandom number generators in a broa-

dening number of applications.

Introduction and widespread acceptance of "personal"

computers, i.e. machines of varying speed and word size,

characterized by small physical size, LSI or VLSI technolo-

gy, and relatively low price has created a need for a satis-

factory small word pseudorandom number generator. Taus-

worthe [10] has proposed a method using linear recurrence

‘ modulo 2 that is independent of computer word size while·

providing a [relatively] infinite period. An algorithm uti-

lizing this method properly coded ixx a portable language

yields a truly portable pseudorandom number generator (RNG).

Considerable discussion has occured concerning the dis-

tinction between the terms pseudorandom and random. The use

of pseudorandom, although correct in the deterministic envi-

1

Page 6: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

2

ronment of an algorithm, has been, in general, dropped in

favor of the term random, leaving context to imply the actu-

al nature of the numbers. This report does likewise; con-

text should make clear those occurances of the term random

that should be interpreted as pseudorandom.

The availability of a language that exhibits excellent

implementation independence (C) encourages the development

of such a generator in that language. C compilers tend to .

generate tight, efficient code, and the presence of the ex-

clusive-or operation and bit manipulation facilities (both

of critical importance to the chosen generation method) in au

high level language recommend C as an implementation lan-

guage. Further, C is now available across the entire hard-

[ware spectrum. This allows time consuming and expensive de-

velopmental work to be done on local, often easily

transportable, inexpensive processors which exhibit slower

compilation/execution speed and [possibly] reduced accuracy.

However, once development is complete the existing code may

be ported to larger, more expensive machines which provide

increased accuracy and speed.

Any method of algorithmically generating a sequence of

numbers precludes validation of the claim that the sequence

is truly random. As Nance [8] has pointed out, randomness

exists as a property that can only be verified by inspection

Page 7: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

3

of the output of the RNG algorithm. Thus, several empirical

tests are needed to ascertain the truth of the claim that an

RNG produces proper results. Further, criteria must be es-

tablished to determine acceptability of any proposed RNG.

The criteria established for the RNG herein proposed are:

Randomness - the numbers generated satisfystatistical tests for randomness.

Portability — the code will run without modificationon any of several processors, producingthe same numbers (within limits ofprecision) for each processor.

Period — the period of the numbers generated issufficiently long for normal applications.

Reproducibility_ — given the same seed value, thesame stream of random numberswill be produced.

Variety — the allowable seed values are minimallyrestricted (to positive values).

Speed - numbers must be generated at a reasonablerate. A statistically perfect RNG thattakes minutes per number generated isworth little. j „

Storage — the storage required should be small.Although memory is now "cheap", thelarger the RNG, the smaller must bethe application program in a limitedmemory environment.

This report presents an RNG, coded in C, which satis-

fies the above criteria for use in situations where port-

ability is of major concern.

Page 8: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

Chapter II

REVIEW OF RANDOM NUMBER GENERATION TECHNIQUES

The need for algorithmic methods for random number gen-

eration was recognized early in the development of compu-

ters. Several techniques have emerged to meet this need.1

Nance [8] gives a brief review of each and Knuth [3] pro-

vides a detailed treatment. Presented here is an introduc-

tion to each technique and a review in light of the criteria

set forth in the introduction.

2.1 MID-SQUARE METHOD

This technique was introduced in the l940's by von Neu-

mann [see Knuth, p. 3]. The idea is a simple one. Given a

starting value with d digits, square the number. The cen-

tral d digits represent the random number generated, and

serve as the seed for the next call. There are several

problems with this technique. The method easily degener-

ates, and a zero once introducedwill perpetuate itself.

Although Metropolis [see Knuth, p. 4] was able to extend the

period to 750,000, it was with a word size of 38 bits. Alt-

hough satisfying conditions of randomness, using word sizes

small enough to claim portability results in unsatisfactori-

ly small periods. Further, the mid-square method suffers

4

Page 9: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

· 5

from a lack of theoretical basis, and any claims must be

made from exhaustive testing of the numbers generated.

2.2 CONGRUENTIAL METHODS

Several methods have been developed from the work of

Lehmer [5] who first proposed a linear congruential method

of the form

xn+1 = (axn + c) mod m, n >= O

where

m = modulus, m > O ·

a = multiplier, O <= a < m·

c = increment, O <= c < m

XO = starting value, O <= XO < m

Proper choice of the above four· values yields sequences

which satisfy the randomness criteria. The choice of c re-

sults in two types of congruential generators. If c = O

then the generator is called a multiplicative congruential

generator. A choice of c greater than zero is termed a mix-

ed congruential generator.

Considerable work has been done concerning the proper

choice of m, a, c, and XO and it is discussed at length in

Knuth [3]. Once proper values have been established, crite-

ria of reproducibility, variety, speed, and size are easily

Page 10: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

6

met. Further, number theory provides a theoretical basis

for the use of such methods to produce random number se-

quences. Unfortunately, the issue of portability is not met

by congruential generators due to the problem of period.

The choice of m is a critical one, since the maximum

period of the generator is m. The upper bound on m is the

word size of the host machine. Use of multiplicative con-

gruential methods on small word size machines yields se-

quences with insufficient period length.

2.3 ADDITIVE METHOD

A special case of the congruential technique is the ad-

ditive method. Knuth [3] ascribes a particular example of

this method to Mitchell and Moore [unpublished, see Knuth p.

26]. The generator is of the form:

Xn = (Xn_24 + Xn_55) mod m, n >= 55, m is even

This special case provides an increase in speed over other

congruential methods (no multiplication is involved) and va-

lues generated do satisfy randomness criteria. Kral [7] in-

dicates that this method may be used satisfactorily on small ·

word length machines. Unfortunately, there is no developed

theoretical basis to support this method.

Page 11: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

. 7

2.4 COMBINATIONAL METHODS °

Two methods have been developed based on combinations

of' previous generating ‘techniques. The first is a ‘table

shuffling approach developed by Maclaren and Marsaglia [7].

Their method uses two congruential generators to fill a ta-

ble. Generator 1 is used to calculate a random value. Gen-

erator 2 is then used to index into the table. The value in

the table location is returned gs the result of the RNG, and

the value of generator 1 replaces the table value. Problems

exist with this method however. If the two generators are

strongly related, the resultant sequence may be less random

than either of the original sequences. Bays and Carter [1]

have developed a separate algorithm that does not display

this difficulty.

The second combinational method was presented by West-

lake [14]. This method also consists of two congruential

generators where the output of the generator is combined by

bitwise addition modulo 2 (exclusive-or) after one genera-

tor's output is subjected to a circular shift. The theoret-

ical basis for the period of such a generator has not been

established.

In both these methods congruential generators are used

as a basis for further manipulation before the final random

number is produced. As has Ibeen discussed, congruential

Page 12: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

8

generators do not satisfy the portability criterion previ-

ously established.

2.5 TAUSWORTHE METHOD

This method was presented by Tausworthe [10] in 1965.

The basis for generation is bitwise addition modulo 2 which

is equivalent to the exclusive-or (XOR) operation. Taus-

worthe showed that using the recurrence relation

ak = (c1ak_1 + c2ak_2 + ... + c¤ak_n) mod 2

where ci is 0 or 1 and ak is a bit ~

the period is length Zn- 1. The use of parallel sequences

of ak allows arbitrary word length random numbers of period

Zn- l. In general, only two of the ci's are non-zero and

the recurrence becomes

ak = (ak_r + ak_q) mod Z where 0 < r < q.

greatly simplifying implementation of the generator. An ex- .

ample will illustrate the working of the method. Let r = 2,

and q = 3. The period of the sequence should, by theory

[10, 6] beZq

- 1 = 7. Generation requires q initial va-

lues. For illustrative purposes three parallel bit streams

are used. If the width (L) of the words being generated

equals q, then all possible combinations are generated as

follows:

Page 13: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

9

O 1 1 11 0 1 21 O O 31 1 0 4O O 1 5O 1 0 61 1 1 7O 1 1 81 O 1 9

Given the three starting values (1, 2, 3), value 4 is gener-

ated as (al + az) mod 2 or equivalently al XOR az. The

process continues as a5 = a3 XOR az, a6 = a4 XOR a3 ...

until the desired number of values have been generated. It

can be seen above that the period is indeed zq- 1 = 7.

2.6 CHOICE gg METHOD

Given the available methods of.random number genera-

tion, it is necessary to choose one for implementation. The ·

Tausworthe method was chosen based on its independence of

word size (which leads to portability) and strong theoreti-

cal basis. Knuth [3] cautions about misinterpretation of

the Tausworthe method. He states that one should not be

mislead into simply using the bit stream generated with an

implied binary point for a floating point number. Such a

method does not produce acceptable streams of numbers. The

method used herein is distinct from that described by Knuth.

Page 14: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

10

Parallel streams are used such that there is a perturbation

of the bit stream. Depending on the number of bytes per

word, this perturbation varies as bytes are shifted and

ORed. The method guarantees the period can be sufficiently”

large regardless of word size, and finally when implemented

in a portable language the generator can produce equivalent

random numbers on a variety of processors of varying word

lengths.i

Page 15: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

Chapter III”

PROPOSED RANDOM NUMBER GENERATOR

3.1 ALGORITHMI

The algorithm to produce random numbers using the Taus-

worthe method is quite straightforward. Of concern are the

reproducibility and portability requirements. These are ad-

dressed respectively in steps 3 and 11 of the algorithm be-

low.

O. Establish initial values for generator(accomplished by compiler).

1. If host identified, go to step 3.2. Establish host specific information.3. Construct new byte ring (level l) if a new seed

~ is provided.4. Initialize random number to 0.5. OR current random number with the value in byte

ring at position indexed by level and seed.6. Calculate new value for location in byte ring at

· position indexed by level and seed by XOR of currentcontents and position indexed by level and pointat distance determined by primitive trinomial.

7. If all bytes generated, go to step 11.8. Left shift r 1 byte.9. Increment byte ring pointers.10. Return to step 5.11. Repeat step 6 gap__ times.

Step Q: As pointed out above, the method requires a set of

initial values (of which there are m). The period of the

generator will be equal to 2m- 1. These values can be es-

tablished at compile time.

11

Page 16: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

12

2

Qggp Q—Q: The first call to the random number generator es-

tablishes a set of host information: word length, number of

bytes per word, the maximum integer representable on the

host machine and the remaining gap value. The code is inde-

pendent of arithmetic type (l's or 2's complement). The gap

is discussed in detail below.

Qggp Q: One of the criteria to be satisfied is that of re-

producibility. To accomplish this, two "levels" are set up

(and explained in detail below) in the initial values. When

a call is made with a new seed, the values in level O are

rearranged into a unique pattern in level 1.

Qggp Q: Initialize the returned value with O.

Qggp Q: The current random number is ORed with that valuen

of the byte ring at the proper level indexed by seed. This

ORing adds a new byte on the right hand side of the generat-

ed number.

Qggp Q: Replace the current contents of the byte ring using

an XOR to calculate the new contents. Based on the primi-

tive trinomial used for the generator, a second index into

the byte ring (relative to the seed point) is calculated,

and the exclusive-or of these two bytes produces the new va-

lue.

Page 17: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

13

Step _Z: If a full word (a sufficient number of bytes

determined in step 2) has been generated, go to the cleanup

phase in step 11.

Step Q: Full words are made by·generating individual bytes

and shifting them in until a word is filled. Shift the cur-

rent value left 1 byte to make room for the next byte of the

word. ·

Step Q: Increment the pointers into the byte ring for gen-

eration of the next byte.

Step lg: Steps 6 through 9 are repeated until a full word

has been generated. __ _

Step ll: For portability to be achieved, the same values

must be generated on various processors. To do so, the same

number of bytes must be "used" on all machines. The XOR re-

placement is performed (with the results being ignored) un-

til the total number of bytes affected on this machine

matches the total number set for the maximum word length ma-

chine.

Page 18: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

14

3.2 IMPLEMENTATION °

Design of the RNG [Figure 1] falls naturally into two

components: initialization and element generation. Ini-

tialization is accomplished through the use of static varia-

bles and two initialization functions. All static variables

are of the form varnam__. The double underscore identifies

such variables as static, and program variables used in the

remainder of this paper will use the double underscore to

emphasize that usage. In-line documentation describes the”

usage of each variable, however some attention should be

given to the s__ array.

Each element of the s__ array (of which there are m__

total) is initialized with a single byte value in accordance

with the generation method discussed below. The initializa-

tion functions are used to establish parameters that control

the RNG mechanism. Function w__size() calculates the word

size of the host machine. It should be noted that the word

size must be an integer multiple of 8 (bits or 1 byte) for

repeatability across processors. If the word size is not a

multiple of 8, the word size is established as the largest

integral byte size less than the actual word length. Func-

tion r__init() then uses that value to establish: l) the

number of random bytes to be generated per word; 2) the gap

length between starting bytes; and 3) the maximum integer

value representable in the host machine.

Page 19: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

15

The generation technique is a further modification to

Thesen and Wang [11] whose work was an outgrowth of Lewis

and Payne [6]. Rather than generating individual bits, each[

byte represents a series of eight parallel bit streams and

the exclusive-or operation of the Tausworthe method is per-

formed byte-wise on the storage ring. The natural extension

is to generate [several] random bytes, shifting when neces-

sary to generate full word random number regardless of word

size. Again, comments in Figure 1 should clarify actions,

however two points must be emphasized: the seed value ef-

fect, and the use of gapping.

Simulation studies require the ability to generate mul-

tiple streams of random numbers as well as the ability to

duplicate streams. The use of a seed value allows both of

these to be realized in the proposed generator. It should

be noted at this point that the seed value ggg; be a pointer

passed to the rand() routine. Actual values may not. bel

passed, since once passed, the contents pointed to will be

changed to reflect a position within the byte ring. Furth-

er, seed values must be positive values.

There are two "levels" maintained in the byte ring.

Level O remains unchanged during program usage. Level 1

contains values used to generate new bytes as requested.

When the generator is presented with a new seed value, en-

Page 20: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

16

/* The following is a Tausworthe random numbergenerator with period 2 ** 98 - 1. Thetrinomial used for generation isx ** 98 + x ** 27 + 1. Seeds must bepositive values. */ ·

/* initial values for byte generation */

static_int s__[2é[98] =é

A _ _ „ ' .{ 9,1,93,19l,l 4,78,§!‘,20,189,74,73,l79,l89,_

85,182,77,25,14,154,220,195,179,48,l78,7,28T56,181,8UÖ166,52,209,130,142,l51,222,18,241}'10f)136,137,176,l6,148,79,137,155,65,13Zt174,174,90,175,128,112,9,137,é72,189:168,l37,125,206,70,64,228,237,192,l47,16,169,203,240,175,239,33,66,13,253270,162,70,32,160,1,131,239,V207,6§,63,175,22,196,249,102,224,167%}, @*;ZQ

{ 0 33;

static int m__ = 98; /* generator period =2m- — 1 */

static int n__ = 27; /* trinomial offset · */static int gap__ = 4; /* max word size (in bytes) */static int wl__ = O; /* word length of host machine */static int nb__ = O; /* number of bytes / word */static float max__ = 0.0; /* (float) of inverse of */

/* maximum integer of host */

w__size()/* Routine to calculate the word size of host machine.

Sets temporary variable to 1, shifts left tillvalue becomes 0, and returns count of shifts. */

{ .unsigned int v;inti;i

= 0; /* shift counter */

for (v = 1; v != O; v <<= 1) /* shift left till O */++i; /* increment shift count */

return(i); /* return shift count */3

Figure 1: Proposed RNG C Code

Page 21: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

17

r__init()/* Routine to set host machine specific variables.

Calls w__size() to determine word size and calculatesnumber of bytes/word, gap, and maximum integer ofhost machine. */

{inti;intml = 127; /*[Qll11l111 */int mask = 255; /* 11111111 */

wl_l = w__size(); /* get word size”"

*/if ( (wl__ Z 8) != 0) /* must be multiple of_§_bits */

wl__ —= (wl__ / 8); /* set to the next lowest */„·.“‘\/* multiple of 8 number of */

y"°‘

/* bytes if required */nb_l/= (wl__/8)+.5; /* calculate bytes per word */

A gap__ -= nb__; /* calculate gap to next word */ ·'Ö W

amfor(i = 1; i < nb__; ++i) /* create largest int. */{ /* by starting with ml, */ml <<= 8;

*/* shifting and ORing */

ml |= mask;””f /* mask till full word */A }

max__ = 1.0 / ml; /* convert to floating point *//* as inverse is calculated */ ~

} .

double rand(pseed)/* This is the random number generation function.

A seed value is passed into this function whichis an index into the s__ array. Sufficientbytes from that array are used to generaterandom bytes shifting until a full word hasbeen generated. That word is normalized intothe range [0,1] and returned. */

int *pseed; §^ /* index into s__ */

unsigned int r; /* random integer being built */int i,t,tp; /* locals */int mask = 255; /*_11111ll1,. */int ol = 66; /* offset 1 */int o2 = 31; /* offset 2 */double v; /* normalized [0,1] result */

%g-V Figure 1. (continued)

Page 22: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

-

18;:if

(wl__ ==O)‘

/* on initial call, set up host */r__init(); /* specific_values */

if (*pseed >= O) /* if the incoming seed 2E,O */{ /* new stream needed */

/* map level O values into level 1 based *//* on use of seed to modify indexes */

t = (*pseed / m__) % m_;

for (i = t + 1; i < m__; ++i)sllllil = slO}l(*ps<-zed + t + 1)% m_};

s_[l}lt} = s_l0}[(*pS¢¢d / ¤¤_) % (m_. · 1)};s__[1][(*pseed / ol) Z 01] =

s__[O][(*pseed / ol ) Z ( ol — 1)];s__[1][(*pseed / 02) Z 02] =

s__[O][(*pseed / 02 ) Z ( 02 — 1)];

*pseed Z= m__; /* map seed value into *//* range O to m__ to *//* function as pointer */

*pseed = (O - *pseed) -1; /* mark */} _ .

*pseed = (O — *pseed) - 1; /* clear mark */

r = s__[1][*pseed]; /* return 1st byte of word *//* set pointer based of trinomial to *//* index of second byte for XOR */

tp = (*pseed + n__) Z m__;„w az

/* perform exclusive-or using contents currently pointedto and position pointed to based on trinomialreplacing contents of position currently pointed to */

s__[1][*pseed] =mask/*increment pointer mod generator period */

*pseed = (*pseed + 1) Z m__; V

Figure 1. (continued)

Page 23: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

19

for (i = l; i < nb__; ++i) /* repeat above operation */{ /* shifting left one byte */r <<= 8; /* and ORing new bytes in */

/* until full word has */r |= s__[1][*pseed]; /* been generated */tp = (*pseed + n__) Z m__;

s__[1][*pseed] = S__[l][*pS€€d]_«S——[l][tp];

*pseed = (*pseed + 1) Z m__;Z

r <<= 1; /* clear sign bit of generated word */r

>>=for(i = O; i < gap__; ++i){ /* generate further bytes discarding results */

/* until number of bytes in maximum word *//* have been generated. guarantees values *//* are same across different word lengths */

tp = (*pseed + n__) Z m__; ‘

s__[1][*pseed] = s__[l][*pseed]S——[l][tp];

*pseed = (*pseed + 1) Z m__;} a .

v = (float) r; F „{ /* convert number to */F.) qvwwßää /* floating point */

ÜFV *= /* normalize on (0,1] */_’ß 1 /* multiply by inverse */1”

/* rather than divide for *//* i¤¢:§;§ed speed */

”*pseed = (0 - *pseed ) — 1; /* mark as new *//* stream for use at next *//* entry to function */

return (v); /* return normalized value */

Z

Figure 1. (continued)

Page 24: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

20

tries from level 0 are remapped into level one in a unique

order based on the seed provided. If the call presents a

seed that is the result of a previous call to the generator

[such "reinitialization" does not occur. The method of dis-

tinguishing "new" seeds from "old" seeds is the use of a—

sign indicator. Upon return from the generator, the con-

tents pointed to by the seed pointer will be a negative

quantity. Seed values are always positive and thus a call

to the generator with a positive seed value indicates a new

seed has been provided by the calling program. The seed va-

lue is critical in ‘the generator since it is this value

which is used in the reordering of bytes as level 0 is co-

pied to level 1. Thus, given a positive seed, each call to

rand() with that seed will copy the values of level 0 to

level 1 and will produce the same sequence of numbers,

yielding reproducibility.

For the RNG to claim true portability, it should be the

case that values generated on various host machines should

yield the same [within precision] results. To that end, a

gapping system was designed to delay starting bytes of each

sequence in such a manner that high order bits of generated

numbers are the same regardless of word size. A maximum

word size machine is established as a static variable

(gap__). This variable contains the number of bytes in a

Page 25: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

21

word on that machine. Bytes must be generated on smaller

word sized machines to "fill the gap" to the beginning of

the next full word of a maximum word size machine. In this

manner, when normalized into the range [0,1], values are

Tmachine independent" discounting precision. Table 1 con-

tains values obtained on several processors for comparison.

Investigation by Tootill, et. al. [12, 13] has shown

that Tausworthe sequences based cxx a primitive trinomial

yield positive results in both theoretical and empirical

tests. As was pointed out in Tootill, et. al. [13], not all

known trinomials provide adequate random number sequences.

Following Lewis and Payne [6], the RNG presented here uses

the trinomial xm—- xn- + 1 with m__ = 98. From Zierler

and Brillhart [16], possible values of n__ are ll and 27.

In this RNG n__ = 27 and the gap value is set to 4 minus the

number of bytes per word. At the end of each random number

generation further random bytes are generated (if necessary)

until the *pseed value (the pointer into the byte ring) has

been incremented a total of gap__ times. This guarantees

that upon the next call to rand(), the initial byte(s) used

in random number generation are the same regardless of word

size. Consequently equivalent values are produced on ma-

chines of different word sizes.

Page 26: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

22

TABLE 1‘

Comparative values generated on different processors

Intel 8088 Intel 8086 Intel 80286

.O70345l6434 .O7034516434 .070345l6434

.2055l164281 .20551164281 .2055l164281

.1620227668l .l620227668l .l620227668l

.4042176580l .4042176580l .4042176580l

.60234382153 .60234382153 .60234382153

.72472304453 .72472304453 .72472304453

.39085OS5086 .39085055086 .39085055086

.4l651661733 .4l65166l733 .4165l66l733

.6367992l873 .6367992l873 .6367992l873

.7349467452O .734946745ZO‘_

.734946745ZO.066682943ZO .066682943ZO .066682943ZO.l5866573077 .l5866573077 .l5866573077.51l85644093 .5l185644093 .51l85644093.70848719749 .708487l9749 .708487l9749.O7449568l63 .O7449568163 .O7449568163.3l669057283 .3l669057283 .3l669057283.54884487442 .54884487442 .54884487442.593279824Zl .59327982421 .5932798242l

VAX ll/785 LSI ll/23+ Motorola 68000

.O70354l9344 .O7034516434 10]O354190l9

.205505967l4 .2055ll64281 .20550597939

.16202667356 .1620227668l .l620266832l

.40421554446 .4042176580l .4042l553875

.60232716799 .60234382l53 .60232720389

.7247222662O .72472304453 .72472230939

.3908419907l .39085055086 .390841984ZO

.41652372479 .41651661733 .41652371982

.63679677248 .6367992l873 .63679681044

.734953l0545 .734946745ZO .73495308965

.O6670l89648 .O666829432O .O6670190046

.l586772948S .l5866573077 .l5867728941

.5ll86l62233 .5l185644093 .51l86l65284

.70848089457 .708487l9749 .70848087719

.0745l400160 .O7449568163 .O7451399859

.31669589877 .3l669057283 .3166959l765

.54885542393 .54884487442 .54885539704

.50448805094 .50450l48015 .50448808lOl

.59328269958 .593279824Zl .59328267534

Page 27: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

23

The code of Figure l assumes a maximum word size less

than 5 bytes. This is only a simplifying assumption, and

may be increased to reflect actual word sizes of host ma-

chines with a corresponding decrease in generating speed on

machines of smaller word length. To increase the maximum

word length, it is only necessary to change the gap__ value

(from 4) in the static declarations. The current value of 4

is chosen for a maximum word size of a 32 bit machine, the

most common [large] word size machines available. The code,

as is, is satisfactory for machines up to (but not includ-

ing) 39 bits since word sizes that are not integer multiples

of 8 are "sized down" to the largest multiple of 8 less than

actual word size.

Page 28: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

Chapter IV

THEORETICAL TESTS AND RESULTS

Previous methods [11, 6] have utilized a. single byte

ring for generation of numbers which requires external [to

the generating code] reinitialization to reproduce streams.

Other methods [15] suffer from word size dependency, do not

generate comparable values across word sizes, or exhibit

other undesirable qualities [2]. The method proposed here

is independent of word size, generating a sufficient number

of bytes to fill the necessary word size. As discussed

above, use of the gapping technique allows generation of

equivalent values on various machines.

The method of Lewis and Payne [6] requires initializa-

tion on a machine by machine basis. Although it is claimed

that the technique is "self initializing", such initializa-

tion must be performed prior to use of the given algorithm

and is time consuming. The proposed method does not require

reinitialization as a prerequisite to program usage.

In all other aspects, the proposed algorithm corres-

ponds to those of [11, 6]. As such, it satisfies the theo-

rem stated and proved in [6] (notation has been changed for

consistency):

24

Page 29: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

25

RNG Theorem: The sequence of L bit numbers (treated as decimal

fractions) generated by rand(),

_

xm—— + xn- + 1, m__ > L, has

1) period p =2m- — 1 if xmi— + xn- + 1 is

primitive,

2) normalized mean of approximately 1/2,

3) normalized variance of approximately 1/12,

I 4) potential k—space uniformity for k < m__/L

As shown above, when m__ = L the period is 2m-- 1.

In such a case, each possible value of the recurrence occurs

exactly once during the period. When m__ > L the period

2m__ - 1 remains the same, but individual values will reap-

pear through the sequence which improves multidimensional

uniformity. Such is the case in the proposed generator.

Empirical tests of a trinomial short period (q = 5) confirm

the proposed generator has the theoretically predicted per-

iod (zq - 1 = 31).

The generator returns values in the normalized range

[O,1]. The RNG theorem predicts mean and variance values

for the generator. Examination of values produced indicate

it matches predicted values well. The proposed generator

was tested with a limited period to confirm adherence to the

Page 30: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

26

above theoretical conclusions. Empirical results confirm

the acceptability of the generator, support the theoretical

basis, and lead to the more extensive testing of a full per-

iod generator presented in the next section. The full per-

iod generator has a period of 298 — 1. This value was se-

lected to provide an extensive period, without excessive

space consumption.

Page 31: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

' Chapter V

EMPIRICAL TESTS AND RESULTS

Any proposed RNG should undergo several empirical tests

as outlined by Knuth [3]. Overstreet [9] has implemented

the majority of these tests, and that package was used to

generate the results shown in Table 3. Complete output of

the Overstreet package is provided as Appendix A.yy ·.·n

}Y7

Ten sample sets were generated using different seed va-

lues. Each sample set was tested with the following crite-

ria:

7Chi-squared Test: 1000 numbers/sequence_ 100 intervals/sequence

5 sequences

/Correlation Test: 5000 numbers to be tested10 maximum lag

Coupon Test: 5000 numbers to be tested50 T, where sequences of length > T

are to be treated as length T5 D, each sequence has a complete

· set of integers from 0 to D-1’ 200 maximum sequences to find

XCap Test: 400 a * 1000 where 0 <= a < b <= 1500 b * 1000

1 starting index of numbers5000 ending index of numbers200 maximum number of gaps to find

KS Test: 500 numbers/sequence _\Ö~5 sequences Ü ‘ ab

·1 starting index 79'

‘„

j Permutation Test: 5000 numbers to be tested‘3 elements/group

_ 27

Page 32: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

?Poker Test: 5000 numbers to be tested

?Runs Test: 5000 numbers to be testedA

7Serial Test: 3 upper limit on (q,r)_ 1 starting index

_ 5000 numbers to be tested.

· A sequence of numbers is said to satisfy randomness

' criteria if it "passes" the tests applied. The criteria for

passing are: ‘ ·

1. "passing" if the results are in the probability· range [.95, .05];

2. "suspect" if the results are outside of the· passing range, but within the range

[.99, .011;

3. "failing" if the results are outside of the suspectrange.

The results of applying the tests to the various streams are

summarized in Table 2. Blanks indicate passing, suspectiua-

lues are shown as'___qlg] in the range [.05, .01]; '>' in the

range [.99, .95], and failing values are shown as ]s{?]for

values < .01; l:3i_fg;_yglues„2w„99. For those tests where

results are given for multiple groups, the suspect and fail-

ing indications are preceeded by a numeral indicating the

number of suspect or fai1in9.gL9§ps.

A full discussion of these tests can be found in Knuth

[3]. Six different processors were utilized in the testing.

As can be seen in Table 1, numbers generated are [nearly]

identical. Several trials of streams using the same seeds

Page 33: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

· 29

· TABLE 2

Summary of Empirical Tests

‘ Seedr‘?‘\

1 2 9 2 f‘“ 3 Vi;) 1 2 1 0 6 7 j5 9 3 9 0 5 4 0 6 yTest O O 7. *\8 5 6 1 9 4 7 “

Chi-squared l< 1> 1</1>°>

QCoupon

\““’”AE Gap > 3 ‘

PermutationPoker

’ f“‘jRuns >

\2>’

Serial < /-„_A > <K+ 1<, glggi 1> A

1> VXK- _

’1éf9

(K+)+ _) > <(K+)— < < >>.» · >(K-><r<—>· (7;)

Seed Suspect Correlations

0 .0328 .0316 -.026850 .03949798 -.0332

105256 -.0258

1111 .02642049 .0268 .03089604 .0377 -.0258

32767

Page 34: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

30

on different processors indicated no significant deviations

between processors, therefore only the Seed Value is indi-

cated in Table 2 and the results may be interpreted for any

processor. lInspection of Table 2 reveals that the proposed

method provides acceptable results for all machines tested.

Storage considerations and speed results are shown in

Table 3. Once again, the proposed method yields acceptable

values in these areas.

Table 3 indicates differences in size of the object

code generated for different processors. This may be attri-

buted to the different C compilers used. All Intel proces-

sors generated files of the same Size since the same compi-

ler (from Digital Research) was used on each.

Page 35: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

31

TABLE 3

Speed and Object Code Storage Requirements

Speed Word Size Storage

Intel 8088 (IBM PC) 276 [16 2494Intel 8086 (AT&T 6300) 531 *16 2494Intel 80286 (IBM PC/AT) 1017 16 „„12494..«Motorola 68000 (NCR Tower) 337 32 1964

LSI 11/23+ (DEC Pro 350)* 592 16 1727

VAX 11/785* , 5000 32 1552

Key: Speed = number of random numbers generated per secondWord Size = number of bits per word for this processorStorage = size (in bytes) of object code file

* These processors had floating point hardware.

Page 36: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

Chapter VI

CONCLUSIONS

The need for a portable RNG has increased with the re-

cent proliferation in computing machinery. The ability to

generate sequences of numbers that satisfy criteria of ran-

domness, portability, period, reproducibility, variety,

speed and storage is necessary for acceptability of any pro-

posed random number generator.

Several methods have been proposed for random number

generators. The Tausworthe method is the only acceptablel

method that meets all the above requirements, the most im-

portant being portability. Previous Tauswortheimplementa—tions

have not met the portability requirement (non-standard

language implementations) or have not met both reproducibil-

ity and versatility requirements. The random number genera-

tor presented herein meets these requirements, and is of-

fered as a feasible alternative to previous generators.

32

Page 37: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

REFERENCES

1. Bays, C. and Durham, S. D. (1976). "Improving A PoorRandom Number Generator," ACM Trans. Math. Software,2:59-64.

2. GPSS/H user newsletter (1984). Wolverine Software Cor-poration, Annandale, VA. 1,1:2.

3. Knuth, D. E. (1981). The Art gf Computer Programming:Volume 2/Seminumerical Algorithms. Addison-Wesley.

4. Kral, J. (1972). "A New Additive Pseudorandom NumberGenerator for Extremely Short Word—Lengths," Informa-tion Processing Letters, 1:164-167 (erratum in 1:216).

5. Lehmer, D. H. (1951). "Mathematical Methods in LargeScale Computing Units," Proc. 2nd Symp. gg Large ScaleDigital Calculating Machinery. Harvard UniversityPress.

6. Lewis, T. G. and Payne, W. H. (1973). "GeneralizedFeedback Shift Register Pseudorandom Number Algorithm,"Q. ACM, 20,3:456-468.

7. Maclaren, M. D. and Marsaglia, G. (1965). "UniformRandom Number Generators," Q. ACM, 12,1:83-89.

8. Nance, R. E. (1981). "Techniques of Random Number Gen-{ eration: A Brief Introduction and Survey", Department,’

of Computer Science, Virginia Polytechnic Institute andState University, Blacksburg, VA.

RQ 9. Overstreet, C. (1972). "A Fortran V Package for Test-=* ing and Analysis of Pseudorandom Number Generators",

Computer Science/Operations Research Center, SouthernMethodist University.

10. Tausworthe, R. C. (1965). "Random Numbers Generated byLinear Recurrence," Math. Comput., 19:201-209.

11. Thesen, A. and Wang, T. (1983). "Some efficient ran-dom number generators for micro computers," TIMS/ORSABulletin, 15:160.

33

Page 38: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

34

12. Tootill, J. P. R., Robinson, W. D., and Adams, A. G.(1971). "The Runs Up-and-Down Performance of Taus-worthe Pseudo-Random Number Generators," J. ACM,18,3:381—399.

13. Tootill, J. P. R., Robinson, W. D., and Eagle, D, J.(1973). "An Asymptotically Random Tausworthe Se-quence," J. ACM, 20,3:469-481.

14. Westlake, W. J. (1967). "A Uniform Random Number Gen-erator· Based on. the Combination, of Two CongruentialGenerators," J. ACM, 14,2:337-340.

15. Whittlesey, J. R. B. (1968). "A comparison of the cor-relational behavior of random number generators for theIBM 360," CACM, 11,9:641-644.

16. Zierler, N. and Brillhart, J. (1968). "On Primitive. Trinomials (Mod 2)," Inform. Contr., 13:541-554.

Page 39: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

R Appendix A

RESULTS OF THE RANDOM NUMBER GENERATOR TESTINGPACKAGE

4 35

Page 40: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

36

ann: LISTIMU unna

/TESTINO SEEDt 0

. LISTIPG OF MIBERS IN DECIHAL.

INDEX VALUE

1 0.0703541642 0.Z055059673 0.1620266444 0.4042155155 0.6023271686 O;7247222667 0.39084196l8 0.41652369S9 0.63679677Z

10 0.73495310511 0.06670188912 0.15867728O13 0.51186162Z14 0.70848089S15 0.07451397216 0.316695B6917 O.54885542418 0.50448805119 0.59328270O20 0.25982832921 0.55182719Z22 O.25004625323 0.61930078324 0.17788618825 0.75510233626 0.10234624l27 0.05894510428 0.69314074S29 ' O.71894425230 0.50840085731 0.43451261532 0.404076219 H33 0.37183904634 0.06183056Z35 0.38676130836 0.27344483137 0.94692021638 0.84874439239 0.26727783740 O.35346305441 0.44488251Z42 0.25063020O43 0.43434143l44 0.42388135Z45 0.05072474l46 0.99190020647 0.04450250048 0.35084784O49 0.80843317550 0.073771000

Page 41: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

37

I·|·|·! CNI•SG.|AR£ *l·¤·¤

TESTIPG SEEO: 0

TEST OF 1000 NIGERS.NIGER OF INTERVALS ARE 100 • APPROXIHATE NIGER IN EACH INTERVAL ARE 10.00

DEGREES OF FREEDQI ARE 99

SEQJEPCE EM CHI-SGJARE

1 0 .51637 115. 6002 0.51325 110.0003 0.49006 88.2004 0.50317 95.4005 0.49629 97. 600

DEGREES PRQABILITYOF FREEDGI 992 952 752 502 252 52 12

99 68.558 76.764 2 89.254 98.500 108.202 122.942 133.8522

Page 42: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

38

lll! CORRELATIG4 HH

TESTINB $EE¤s 0

_ CORRELATIGI TEST OF 4990 NIBERS.

. LAG CORRELATIGI

1•0.00212550Z0.03288177

3 •0.01B219924 0.013030115 -0.021157596 0.00079199 ·_ 7 -0.010307778 0.031631469 ·0.02372201

10 •0.02662S46

Page 43: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

39

uu CUJPGI COLLECTOR ¤-¤·¤·¤

TESTIPG SEEO: 0

MRBER OF COJPGI COLLECTOR SE§1EN"I’S REIIESTEO IS 200

UPPER BGM0 GI LEPGTII OF SEGMENTS IS 50

SEGHENTS RST OINSISTS OF A CQIPLETE SET OF INTEGERS FRG1 0 TO 6

HAXIRI1 AIQNT OF NIBERS AVAILABLE FOR TESTINB IS 5000 _

LHGTH DOEOTE0 'GSERVEO

5 7.68 66 15.36 167 19.97 208 21.50 19 .9 20.90 _ 23

10 19.10 1611 16.76 1612 16.33 13 .13 12.02 1616 9.96 1015 8.17 1216 6.66 717 5.60 1018 22.18 26

OR GREATER

RIBER OF SEGIENTS FGNO IS 200

HAXIRII SEGHENT LE}GT|·| FGN0 IS 37

CHI•$¤JARE HITH 16 OEOREES OF FREEDG1 IS 11.0255

OEGREES PRGABILITYOF FREEDG1 992 952 752 502 252 52 12

16 6.119 6.305 10.220 13.500 17.235 23.601 28.291

Page 44: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

40

eu:-¤·¤· GAP TEST aus-nur

TESTIFS SEED: 0

BGNOS ARE 0.40000 T0 0.50000NIGERS CHECXE0 ARE INOEXED FROH 1 TO 5000GAPS RERJESTEO ARE 200 GAPS FOLNO ARE 200INOEX OF LAST NIGER CHECXE0 IS 1984

GAP LEPGW PREDICTED GAPS GSERVED GAPS

0 20.00 291 18.00 212 16.20 123 14.58 10 °4 13.12 115 11.81 126 10.63 107 9.57 78 8.61 89 7.75 7

10 6.97 911 6.28 712 5.65 513 50.84 52

OR GREATER -

HAXINI1 GAP LEHBTH FUND IS 65

THE CHI-SQJARE VALUE FOR 13 OEGREES OF FREEDGH IS 9.03809

\

OEGREES PRGABILITYOF FREEDG1 992 952 752 502 252 52 12

13 3.575 5.628 ( 9.353 12.500 16.103 22.078 26.835

Page 45: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

%1

!·¤·¤·| PEMUTATIG4 TEST l·l·¤·!

TESTDG SEED2 0

THE INPUT SEQJÜCE IS DIVIDEO INTO 1666 GRGJPS OF 3 ELEHENTS EACH

THE HAXINI1 NIGER OF NIGERS TO BE TESTEO IS 4998

EXPECTE0 NIGER IN EACH INTERVAL IS 277.67

CHI-SQJARE HITH 5 OEGREES OF FREEOGI IS 6.30852

OEGREES PRGABILITYOF FREEDGI 992 952 7% 502 E2 52 12

5 0.554 1.146 2.675 4.351 6.626 11.070 15.090

Page 46: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

42 _

I'l‘l*l PGCER TEST l*l'|

TESTIIS SEED: 0

PCXER TEST OF 1000 GRWPS.

FORAORGIPOF5N.IBERS•!¢lRETEST!Y£N04HINYAREL|4I$JEINTHERA}|3E1TO10

MIBER DIFFERENT PREOICTE0 GSERVED

2 13 183 180 1914 504 4875 302 303

CHI-SQJARE FOR 3 OEBREES OF FREEDG1 IS 2.67035

OEGREES PRGABILITY7 OF FREEDGI 992 952 752 502 252 52 12

3 0.11.5 0.352 1.213 2.366 4.108 7.81.5 11.340

Page 47: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

43

TESTIBG SEED: 0

TABLE OF RUS UP855 RUS OF LDSTH 1

1079 RUS 0F LENGTH 2415 RUS OF LEPSTH 5128 RUS OF LENGTH 455 RUS OF LEFSTH 5

_ 12 RUS OF LEWTH 6 OR PURE

THE HAXIHJ1 RUI IS OF LHSTH 7

CHI-SGJARE STATISTIC WITH 6 DEGREES OF FREEDUI IS 15.99121

DEGREES PROBABILITYOF FREEDUI 992 952 752 502 252 52 12

6 0.872 1.655 5.455 5.548 7.841 12.590 16.810

Page 48: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

44

HH SERIAL TEST mv-¤·¤

TESTIPG SEED: 0”

NJBERS CHECXE0 ARE IPDEXE0 FRGI 1 TO 5000 __·

TESTIPG PAIRS OF MJFBERS lG;R) HHER! O AMO R LIE BETHEEN 0 AND 2

G R MIIER IN CATEWRY

0 0 272V 0 1 283

0 2 2651 0 2681 1 2741 2 2882 0 2882 1 2792 2 283

EXPECTED NJBER IN EACH CATEQRY IS 277.7

CHI-SGJARE VALUE FOR 8 DEOREES OF FREEDGI IS 2.05882

DEGREES PRGABILITY' 0F FREEDCI1 992 952 752 502 252 52 12

8 1.646 2.733 5.071 7.344 10.220‘

15.510 20.090

Page 49: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

45

SSS-! K-S GOOONESS-OF•FIT TEST l·¤·l·l

TESTI)G SEEDs 0

NIGER OF NIGERS IN EACH KS TEST IS 500NIGER OF TESTS TO BE PERFORHEO IS 5

8LxK K+ K-

1 0.1165 1.03182 0.6177 0.8768 „3 0.1716 0.64194 0.4318 1.09815 0.5797 0.3728

— PRNABILITY IN Z 99 95 75 25 05 01

SAHPLE SIZE S 500 0.0642 0.1538 0.3726 0.8254 1.2163 1.5085

OVERALL OISTRIBUTIQI FORMED 8Y CGGINIPG ALL PREVICIJS K+ STATISTICS•AND ALL PREVIOLS K- STATISTICS ANO GETTDG A KS VALUE FOR EACH

(K•)+ S 1.0426 (K+)- S 0.0599(K-)• S 0.2005 (K-)-

S 0.8612

PRQABILITY IN Z 99 95 75 25 05 01

SAMPLE SIZE S 5 0.0215 0.0947 0.3249 0.7674 1.1400 1.4020

Page 50: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

46

unse LISTINB ¤**¤

TESTIIG SEED: 50

LISTINB OF MQBERS IN DECIHAL.

INDEX VALUE

1 0.73240977S2 0.039217561_3 0.58037418l4 0.669625878

‘·

5 . 0.1141009936 0„399923563 .7 0.22048062l8 0.2984868889 0.114009619

10 0.88591104711 0„37550592412 0„07505053313 0.07035380614 0.00341910515 O.349537909 .16 0.98285752S17 0.78850561418 0.13018178919 0.37448513520 0•10929185221 0.54787063622 0.03075590723 0•49753075824 0.94845205S25 0„07034456726 0•36424344827 0.02646931628 0.67351865829 0•73087322730 0.55866134Z31 0.40129703332 0.541784Z2733 0„845032692 .34 0„12758463635 0.79129445636 0.48060524S37 0.36441934138 0„31180214939 0.32158434440 0.55683052S41 0.82294082642 0•30040639643 0.58586770344 O.49040299745 0.29672Z29346 0.17082279947 0.51575243S48 O.16368877949 0.47719401150 0„657904506

Page 51: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

47

¤·I·I·¤ CHI-SRIARE l·l-I-!

TESTIFG SEEO: 50

TEST OF 1000 NRGERS.' NIGER OF INTERVALS ARE 100 • APPROXIIMTE NIGER IN EACH INTERVAL ARE 10.00

OEGREES OF FREEDOH ARE 99

SEQUE}£E HEAN CHI-SRJARE

1 0.50152 102.800Z

‘ 0.48925 84.8003 0.50195 83.6004 0.49838 120.8005 ~ 0.50010 104.400

OEGREES PRQABILITYOF FREEDQ1 992 952 752 502 252 52 12

99 68.558 76.764 89.254 98.500 108.202 122.942 133.852

Page 52: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

’48

uu CQRRBLATION mu

TE$TIr¤ SEED: 50

CORRELATIIN TEST OF 4990 MIBERS. _

LAB CORRELATIGI

1 0.039426002 -0.012098%3 -0.016088494 -0.009867165 0.004861186 0.011674927 0.018933648 -0.0073256O9 0.02474173

10 0.00812354

Page 53: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

Q9

¤·¤·¤·¤ COJPCN COLLECTOR HHTESTI}8 SEEO: 50

”NIGER OF COJPGI COLLECTOR SEGHENTS REGJESTEO IS 200

UPPER BQAI0 G4 LEFGTII OF SEGIENTS IS 50

SEGHENTS HJST CGSISTS OF A CIHPLETE SET OF INTEGERS FRG1 0 TO 6

MAXIM}! APUNT OF NRBERS AVAILABLE FOR TESTIM IS 5000

LEIGTII EXPEOTEO QSERVEO

5 7.68 86 15.36 157 19.97 228 21.50 259 20.90 16

10 19.10 2911 16.76 1712 16.33 1213 . 12.02 1016 9.96 515 8.17 816 6.66 717 5.60 518 22.18 21

OR OREATER

IIIBER OF SEGMENTS Füll) IS 200

HAXIHII SE¤1ENT LEWTII FUJI! IS 33

CHI-SOUARE HITH 16 OEGREES OF FREEDGI IS 10.3881

OEGREES PRGABILITYOF FREEO01 992 952 752 502 252 52 12

16 6.119 6.305 10.220 13.500 17.235 23.601 28.291

Page 54: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

50

¤·¤·¤·•• GAP TEST uu

TESTINS SEED: 50

BGNDS ARE 0.40000 TO 0.50000MIBERS CHECKED ARE INDEXED FRG! 1 TO 5000GAPS REGUESTED ARE 200 GAPS FOLND ARE 200INDEX OF LAST MRBER CHECKED IS 2126

GAP LENETH PREDICTED GAPS GSERVED GAPS

0 20.00 191 18.00 142 16.20 143 14.58 154 13.12 215 11.81 136 10.63 47 9.57 158 8.61 129 7.75 2

10 6.97 2 '11 6.28 512 5.65 513 50.84 59

OR GREATER

MHH}! GAP LEFGTH FGND IS 54

THE CHI·SGUARE VALUE FOR 13 DEGREES OF FREEDG! IS 24.11218

— DEGREES PRGABILITYOF FREEDGI 992 952 752 502 252 52 12

13 A 3.575u

5.628 9.353 12.500 16.103 22.078 26.835

Page 55: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

51

lll! PERNITATIGI TESTHH—

TESTIHB SEEO: 50

THE INPUT SEQIEPGE IS OIVIDEO INTO 1666 GRUJPS OF 3 ELEHENTS EACH

THE HAXINI1 NIGER OF NIGERS TO BE TESTED IS 4998

EXPECTE0 NIGER IN EACH INTERVAL IS 277.67

CHI··SäJARE HITH 5 DEGREES OF FREEDGI IS 4.17647

DEGREES PRQABILIWOF FREEDG1 992 952 752 502 252 52 12

5 0.554 1.146 2.675 4.351 6.626 11.070 15.090

Page 56: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

52

uu PGKER TEST ¤·¤·¤·¤

TESTIFG SEEO: 50

PMER TEST OF 1000 GROUPS.

FORA6RCIJPOF5N.!BERS•HEARETESTIhßHONHANYARE\„lII¤JE INT|·IERAN3E1T010

IIIBER DIFFERENT PREDICTED WSERVED

2 13 17‘

· 3 180 1716 506 5005 302 311

OH!-SRIARE FOR 3 DEGREES OF FREEDG1 IS 1.57633

DEGREES PRQABILITYOF FREEDG1 992 952 7% 502 252 52 12

3 0.115 0.352 1.213 2.366 6.108 7.815 11.360

Page 57: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

53

I-ll-! RUS W uu

TESTIPG SEEO: 50

TABLE OF RLN5 UP867 RUS OF LENBTH 1974 RLNS OF LEFGTH Z470 RUS OF LEBBTH 3130 RUS OF LEWTH 440 RLNS OF LEIGTH 5

9 RUB OF LENGTH 6 OR PQRE

THE MAXIM]! Rill IS 0F LDSTH 6

CHI-SSJARE STATISTIO HITH 6 OEGREES OF FREEDG4 I5 12.48901

OEGREES PRQABILITYOF FREEOQ1 992 952 752 502 252 52 12

6 0.872 1.635 3.455 5.348 7.841 12.590 16.810

Page 58: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

54

HH SERIAL TEST H-H

TESTINS SEEO: 50

NIGERS CHECXE0 ARE INOEXEO FRG1 1 TO 5000 -

TESTUB PAIRS OF NIGERS ll•R) HHERE 0 AN) R LIE BETHEEN 0 AND 2

H R NIGER IN CATEWRY

0 0 2930 1 277O 2 2441 0 2771 1 2921 2 2942 0 2722 1 2812 2 270

EXPECTED NIGER IN EACII CATEGORY IS 277.7

CHI-SGJARE VALUE FOR 8 OEGREES OF FREEDG1 IS 7.00000

OEGREES PRGABILITYOF FREEOGQ 992 952 752 502 252 52 12

8 1.646 2.733 5.071 7.344 10.220 15.510 20.090

Page 59: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

55 _

· ¤·|·¤·I K•S ®O0NESS•OF-FIT TEST III!

TESTDG SEEOx 50

NIGER OF NIGERS IN EACH KS TEST IS 500NIGER OF TESTS TO BE PERFOIUED IS 5

BLOCK lu K-

1 0.7432 0.85262 0.5602 0.56903 1.2109 0.17894 0.5077 0.39455 0.5861 0.6270

PRGABILITY IN Z 99 95 75 25 05 01

SAHPLE SIZE I 500 0.0642 0.1538 0.3726 0.8254 1.2163 1.5085

lOVERALL OISTRIBUTIIN FORHEB BY CGGINUG ALL PREVIGIS K•

STATISTIC$•AN0 ALL PREVICKJS K- STATISTICS AN0 GETTIN3 A KS VALUE FOR EACH

~ (K•l+ I 0.2937 lK•)- I 0.9007IK•)• I 0.5714 (K-)- I 0.1713

uPRQABILITY IN Z 99 ° 95 75 25 05 01

SAHPLE SIZE I 5 0.0215 0.0947 0.3248 0.7674 1.1400 1.4020

Page 60: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

56

unna LISTING unna

TESTING SEED: 97

LI$TI}ß OF PLYBERS IN 0ECIHAL•

INDEX VALUE

1 0„7502767772 0.6980367163 0•0392175616 0„5803761B1 „5 0.66962587B6 0„1161009937 0.3999235638 0.22068062l9 0•298686888

10 0„11600961911 0„88591106712 0.37550592613 0.07505053316 0„36669586715 0.00361910S16 O.36953790917 0.98285752S18 0„78850561619 0„13018178920 0.37668513521 0•10929185222 0•56787063623 0„03075590726 0.69753075B25 0.96865283O26 0„65083615527 O.36626366828 0„02666931629 0.67351865830 0.73087322731 0•558661601 ·32 0.221609533

·33 0„56178622736 0.86503269Z35 0.127586636 _36 0.79129665637 0.68060526S38 0„36663859339 0„31180216960 0.32158636661 0.55683052S62 0•82296082663 0.30061569566 0.99315530165 0.69060299T66 0•29672229367 0.17082279968 0•51575Z63569 0.16367811050 0.658206356

Page 61: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

57

¤·¤·¤·¤ CHI·s¤UARE ¤·¤-MTESTIIG SEED: 97

TEST OF 1000 NIGERS. -NIGER OF INTERVALS ARE 100 p APPRGGHATE NIGER IN EACH INTERVAL ARE 10.00

DEOREES OF FREEONI ARE 99

SEQUENZE HEAN CHI-SGJARE

1 0.49128 124 . 6002 0.50188 92.2003 0 .49799 134. 000g~4 0.49477 84.2005 0.48487 83.400

OEGREESPRQABILITYOFFREE001 992 952 752 502 252 52 12

99 68.558 76.764 89.254 98.500 108.202 122.942 133.852

I

Page 62: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

58

wu CORRELATIW um

TESTING SEEO: 97

CORRELATION TEST OF 4990 NUMBERS. _

LAG CORRELATION

1 0.010492042 -0.017741133 ·0.011599704 -0.0050651l5 •0.007113776 —0.006583087 0.010999238 -0.009059839 0.00405338

10 -0.01109005

Page 63: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

59

HH CGJPO! COLLECTOR muTESTUG SEEOx 97

MIBER OF CMJPG! COLLECTOR SEGIENTS REWESTEO IS 200

UPPER BGN0 G! LEN3TI·| OF SEGHENTS IS 50SEGHENTS HJST CGRSISTS OF A CQIPLETE SET OF INTEGERS FRG! 0 TO 4

HAXIHI! MIIIIT OF MIBERS AVAILABLE FOR TESTDG I$_ 5000

LENBWI EXPEOTE0 QSERVEO

5 7.60 0U

6 15.36 147 19.97 14

0 21.50 229 20.90 17

10 19.10 1811 16.76 1512 14.33 1613 12.02 1614 9.96 915 0.17 1016 6.66 017 5.40 1110 22.10 22

OR GREATER

M!8ER OF SEGIENTS FUND IS 200

MAXIM.}! $Eä!EN'I’ LE}GW! FG}0 IS 32 _CHI-SQIARE HIT}! 14 OEBREES OF FREE00! IS 10.9015 .

OEGREES PRGABILITYOF FREEDG! 992 952 752 502 252 52 12

14 4.119 6.305 10.220 13.500 17.235 23.401 20.291

Page 64: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

60

¤·¤·••·¤·GAP 1'[$1' A-um-n

TESTDG SEED: 97

BGNOS ARE 0.60000 TO 0.50000NIGERS CHECKE0 ARE INDEXE0 FRG1 1 TO 5000GAPS REQUESTEO ARE 200 GAPS FGI40 ARE 200INDEX OF LAST NIGER CHECKED IS 2368

GAP LEPBTH PREDICTED GAPS GSERVED OAPS

0 20.00 171, 18.00 92 16.20 163 16.58 106 13.12 125 11.81 116 10.63 97 9.57 178 8.61 69 7.75 8

10 6.97 1111 6.28 712 5.65 213 50.86 66

OR OREATER

HAXIHI1 GAP LE}6TH FGIIO IS 58

THE CHI-SQJARE VALUE FOR 13 DESREES OF FREEDGI IS 21.56163

DEGREES PRQABILITYOF FREEDGI 992 952 752 502 252 52 12

13 3.575 5.628 9.353 12.500 16 . 103 22 . 078 26 .835

Page 65: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

61

l·I·l·l PERNITATIGI TEST l·|·l·|

TESTIFG SEED: 97

THE INPUT SEQUEMZE IS DIVIOED INTO 1666 GRGJPS OF 3 ELEHENTS EACH

THE HAXINI1 NIGER OF NIGERS TO BE TESTE0 IS 6998

EXPECTED NIGER IN EASH INTERVAL IS 277.67

CHI-SQJARE HITH 5 OEGREES OF FREEDGI IS 5.53701

DEBREES PRGABILITYV

OF FREEDG4 992 952 752 502 252 52 12

5 0.556 1.166 2.675 6.551 6.626 11.070 15.090

Page 66: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

62

uu PG(ER TEST *¤·¤·¤

TESTRG SEED: 97

PEKER TEST OF 1000 GRGJPS.

FORAGR¤JPOF5MlBER$•HEARETESTI}ßH0|HANYARE\I|IG.JEINTHERA}¢$E1TO10

MIBER IIIFFERENT PREDICTE0 QSERVED

2l

13 - 16 _3 180 1864 504 4765 302 321

CHI•SMJARE FOR 3 DEGREES OF FREEDQI IS 3.32314

DEGREES „ PRQABILITYOF FREEDG1 992 952 752 502 252 52 12

3 0.115 0.352 1.213 2.366 4.108 7.815 11.340

Page 67: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

63

uns Ruß W uu

TESTIYB SEED: 97

TABLE OF RLNS UP887 RLNS OF LEWTH 1

1047 RLNS OF LENBTII 2457 RLNS OF LHBTII 3123 RLNS OF LENBTH 4

21 RLNS OF LEPGTII 58 RUB OF LHGTDI 6 OR FDR! .

THE MAXDI!1 RLN IS OF LEBSTH 7

CHI-S¤|ARE STATISTIC HITII 6 OEGREES OF FREEOGI IS 10.05786

OEGREES PRGABILITYOF FREEOGI 992 952 752 502 252 52 12

6 0.872 1.635 3.455 5.348 7.841 12.590 16.810

Page 68: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

64

uu SERIAI. TEST ·¤-¤·¤-1•

TESTIN3 $EE0:V 97 ·

NIBERS CHECKE0 ARE INOEXEO FRGI 1 TO 5000

TESTIIG PAIRS OF NIGERS (9,R) WHERE 0 AN0 R LIE BETHEEN 0 AND 2

G R NIGER IN CATEGORY

0 0 3050 1 2900 2 2841 0 2871 1 2581 2 2842 0 2582 1 2542 2 280

EXPECTEO NIGER IN EACII CATEGORY IS 277.7

CHI•S$JARE VALUE FM 8 OEGREES OF FREEDGI IS 8.66387

OEGREES PRQABILITY0F FREEOG1 992 952 752 502 252 52 12

8e

1.646 2.733 5.071 7.344 10.220 15.510 20.090

Page 69: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

65

III! K-S EONESS-OF-FIT TEST IIII

TESTIPS SEEO: 97

NIGER OF NIGERS IN EACH KS TEST IS 500NIGER OF TESTS TO BE PERFORHE0 IS 5

BLOCK Kb K-

1 0.9525 0.1199 .2 0.7503 0.4739

. 3 0.6420 0.51504 0.4171 0.84425 1.0496 0.6060

PROBABILITY IN Z 99 95 75 25 05 01

SAHPLE SIZE I 500 0.0642 0.1538 0.3726 0.8254 1.2163 1.5085

OVERALL OISTRIBUTIGJ FORHEO BY CIIGINIPG ALL PREVIIIB K•STATISTIC$•

AN0 ALL PREVIGS K- STATISTICS AN0 GETTIM A KS VALUE FOR EACH

(K•)+ I 0.2469 (KH- I 0.8082(K·)+ ¤ 0.6255 (K-)- I 0.3618

PRQABILITY IN Z 99 95 75 25 05 ~ 01

SAHPLE SIE I 5 0.0215 0.0947 0.3249 0.7674 1.1400 1.4020

Page 70: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

66

ana! LISTING unna _

TESTING SEED: 98

LISTDB OF MIBERS IN DECIHAL•

INDEX VALUE

1 0.0078658762 0•6095281843 0•4788295634 0.47917819O5 0.195758224° 6 0.5289059287 0.0555487548 0„6300722369 0.019976601

10 0.14799183611 0.07568556112 0•62138694513 0.03658084Z14 O.371107101

' 15 0.07558411416 0.07415175417 0.50698638O18 0•14894598719 0.88036906720 0•51605194821 0„26776510522 0.01183889123 0„54100596924 0„538861156Z5 0.30498361626 0.199573457 .27 0.08994716428 0.44403713929 0.04972997330 0.15061974531 0•23524063832 0•44352257333 0.19080090S ’34 0.82862335435 0.010903493 ‘36 0.00187736437 0.411S7984738 0.27856171139 0.42313116840 0.48655009341 0.88993334842 0.16132968743 0.25389498S44 0.78707188445 O.98553407246 0.92644852447 0.39263963748 0.81704562949 0.958895Z6650 0„883063078 .

Page 71: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

67

¤·¤·|·! CHI•$¤.|ARE I·I·I-I

TESTIPG SEEO: 98

TEST OF 1000 MRBERS.MIBER OF INTERVALS ARE 100 • APPROXIHATE MIBER IN EACH INTERVAL ARE 10.00OEGREES OF FREEDG1 ARE 99

SEQJEICE HEAN CHI-SQJARE

1 0.49676 · 87.6002 0.48908 112.0003 0 .49971 85. 2004 0.49752 89.6005 0.51113 72.600

OEGREES . ~ _ PRQABILITYOF FREEOG1 994 952 752 502 252 52 12

99 68.558 76.764 89.54 98.500 108.202_ 122.942 133.852

Page 72: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

68

. ¤·¤·¤·¤ CORRELATICN ¤·¤·¤-TESTDG SEED: 98

CORRELATIGI TEST OF 4990 PIIBERS.

LAG CORRELATIGI

1 0.001332342 0.009043463 0.000957384 0.023598425 -0.014805076 —0.015760267 -0.0028262Z8 —0.033299699 0.00796137

10 •0.02299067

Page 73: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

69

¤·¤•·¤·¤• cwP¤4 COLLECTOR H-l-¤

TESTINB SEEO: 90

NIGER OF Ct1lPG| OOLLECTOR SEGIENTS REQJESTE0 IS 200LPPERBGNOGILEWTH OF SEGIENTSIS 50

SEGIENTS NBT CGSISTS OF A CIHPLETE SET OF INTEGERS FRG1 0 TO 4 —

HAXINI1 AFUIIT OF NIGERS AVAILABLE FOR TESTII6 IS 5000”

LE}$TH EXPEOTE0 GSERVEO

5 7.60 46 15.36 117 19.97 270 21.50 149 20.90 20

10 19.10 2111 16.76 1112 14.33 1713 12.02 1014 9.96 1315 0.17 916 6.66 417 5.40 510 22.10 26

OR GREATER

NIGER OF SEGENTS FQII IS 200

HAXINII SEG1EN'I’ LEPGTII FGNO IS 36

CHI·S$JARE HITH 14 OEOREES OF FREEOGI IS 16.2012

OESREES PRGABILITYOF FREEDGI 992 952 752 502 252 52 12

14 4.119 6.305 10.220 13.500 /‘17.235 23.401 20.291

Page 74: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

70

¤·¤·¤·•• SAP TEST uu

TESTIIG SEED: 98

BUNDS ARE 0.40000 T0 0.50000„ NIGERS CHECKED ARE INDEXED FRU'1 1 T0 5000

GAPS REUJESTED ARE 200 GAPS FUND ARE 200INDEX OF LAST NIGER CHECKED IS 2253

GAP LENZTHu

PREDICTED GAPS QSERVED GAPS

0 20.00 191 18.00 142 16.20 93 14.58 124 13.12 135 11.01 136 10.63 117 9.57 9

, 8 0.61 99 7.75 11

10 6.97 911 6.20 012 5.65 513 50.84 50

0R GREATER

HAXINI1 GAP LE}GTH FUI0 I5 59

THE CHI-SUIARE VALUE FOR 13 DEGREES OF FREEDG1 IS 8.29115

DEGREES PRQABILITY0F FREEDU1 992 952 72 502 252 52 12

13 3.575 5.628 . 9.353 12.500 16.103 22.078 26.835

Page 75: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

71

Hä!x

PERIIITATICN TEST HH

TESTIhG SEED: 98

THE INPUT SEQJENZE IS IIIVIDED INTO 1666 GRWPS OF 3 ELEHENTS EACH

THE HAXIHI4 NIGER OF NIGERS TO BE TESTED IS 6998

EXPECTED NIGER IN EACH INTERVAL IS 277.67

¢HI·$$JARE HITH 5 DEGREES OF FREEDGI IS 6.78391 .

IIEGREES PRGABILITYOF FREEDCI1 992 952 752 502 252 52 12

5 0.556 1.166 2.675 6.351 6.626 „ 11.070 15.090

Page 76: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

72

uns PIXER TEST HH

TESTIW SEED: 98

PGKER TEST OF 1000 ORGPS.

FORAOR¤JPOF5NIGER$;V¢ARETESTIhBHOI_HANYAREUIIQlJEINTHERA|£E1TO10I

NIGER OIFFERENT PREOICTE0 QSERVEO

2 13 133 180 1836 506 6885 302 31.5

CHI-SHJARE FOR 3 DEGREES OF FREEDGI IS 1.10962U

DESREES PRGABILITYOF FREEDQU 992 952 752 502 252 52 12

· 3 0.115 0.352 ~ 1.213 2.366 6.108 7.815 11.360

Page 77: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

73

uu Rlß UP ¤-¤·¤·¤

TESTIPG SEEO1 98

TABLE OF RUS UP818 Riß OF LEPGTH 1

1053 RIMS OF LEPUTH 2450 Rlß OF LENGTPI 3126 RIMS OF LEPGTH 438 RLNS OF LENSTH 5 —5 RINS OF LEPGTH 6 OR PURE

THE PIAPCIPIM RIM IS OF LEPU'I'H 7

CHI-SQUARE STATISTIO HITH 6 OEGREES OF FREEOGI IS 5.21495

DEGREES PR$ABII.ITYOF FREEOQI 992 952 752 502 252 52 12

6 0.872 1.635 3.455 E 5.348 7.841 12.590 16.810

I

Page 78: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

74

¤·¤·¤·¤ SERIAL TEST H-¤·¤

TESTIIG SEED: 90

NIBERS CHECKE0 ARE INJEXE0 FRQ1 1 TO 5000

TESTIPS PAIRS OF MRBERS (G:Rl HHERE Q A70 R LIE BETHEEN 0 AN0 2

G R NIBER IN CATEGORY

0 0 2620 1 2710 2 2691 0 3071 1 279 _..1 2 2792 0 2912 1 2722 2 270

EXPECTE0 NIBER IN BACH CATEGORY IS 277.7

CHI•$üJARE VALLE FOR 0 DEGREES OF FREEIIGI I5 5.39376

DEGREES PRGABILITYOF FREEDGI 992 952 752 502 252 52 12

' 0 1.646 2.733 5.071 { 7.344 10.220 15.510 20.090

Page 79: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

75 ·

SSH K—S GOODNESS-0F·FIT TEST ¤·¤-M

TESTINS SEEOs 98 '

NJBER OF MIBERS IN EACH KS TEST IS 500N.\BER OF TESTS TO BE PERFORHE0 IS 5INITIAL VALUE IS 1059076088

BLOCK K4 K- .

1 0.7215 0.3925 ' -2 0.8510 0.63603 0.9742 * 0.1925\4 0.8816 0.59835 0.8060 0.5250

PRQABILITY IN Z 99 95 75 25 05 01SAHPLE SIZE S 500 0.0642 0.1538 [ 0.3726 0.8254

‘1.2163 1.5085

OVERALL OISTRIBUTIGI FORQED BY CGBINIPG ALL PREVICKB K•$1'ATISTICS•AND ALL PREVIGJS K- STATISTICS AN0 GETTIIÜ A KS VALUE FOR EACH

|K•)• S 0.3351(KH-lK•)•S 0.9958

(K-)-S 0.1597

PRGABILITY IN Z 99 95 · 75 25 0501SAHPLESIZE S 5 0.0215 0.0947 0.3249 . 0.7674 1.1400

u1.4020

Page 80: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

E 76

lll! LISTINB una;

TESTING SEEO: 105

LISTINB OF MIBERS IN 0ECINAL•

IDEX VALUE

1 0•4242278342 0„2098621733 0•3804329634 0.4430332785 0.41264373l6 0.1864646677 0.7932292828 0„1295260799 0•21Z936938

10 0.36214250311 0„87529104912 0.48170584413 0.61151897914 0.85743939915 O.32653629816 0„86820244817 0„97871810218 0•25488299119 0„873512864 ,20 0.36788237121 0„80373084522 0.01067347S23 0„60952818424 0.01009365Z25 0.47915720926 0•10354840827 0.01732231328 0.73204720O29 0,69676500630 0.32836651831 0.661667049 ·32 0•57138061533 0.03494890834 0.29628413935 0„82135653536 0.32559943237 0.54861283338 0.67285400639 0.904041409 -40 0.35206478841 0„55495947642 0•82011640143 0.66033011744 0„03Z6Z050145 0.90159541446 0„16167497647 0„12506508848 0.02337850649 0.11092662B50 0„291921675

Page 81: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

77

¤·¤·¤·•• CR!-SIRJARE HH

TESTI}8 $EEOz 105

TEST OF 1000 NIIBERS.NIGER OF INTERVALS ARE 100 g APPROXIHATE NIGER IN EACH INTERVAL ARE 10.00DEGREES OF FREEOCI4 ARE 99

SEQJEME HEAN C||I•S%|ARE

1 0.50420 06.2002 0 .49359 104. 6003 0.49275 104.4004 0.50405 90.4005 0.49395 96.200

DEGREES _ _ PRWABILITYOF FREE001 992 952 752 502 252 52 12

99 60.550 76.764 09.254 90.500 100.202 122.942 133.852

Page 82: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

78

”lll-I CORRELKTIQ lll-!

}

TESTIPG SEEO: 105

CORRELATIG{ TEST OF 4990 MIBERS.

LAS CORREUTIUI

1 -0.010186882 •0.008224103 •0.011559194 —0.02084544 ·5 •0.004363026 0.008625317 0.004528118 0.002687699 -0.01136295

10 -0.00058731

Page 83: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

79

una CaIPa| OOLLECTOR uns

TESTIIB SEEDS 105

HRBER OF CGJPGI COLLECTOR SEGHENTS REQJESTEO IS 200

UPPER BaNO G! LEFSTI-I OF SEGHENTS IS 50

SEGHENTS HST CGBISTS OF A CIHPLETE SET OF INTEGERS FRG! 0 TO 4

HAXIHJ1 AIUNT OF HIBERS AVAILABLE FOR TESTIIG IS 5000

LUST}! EXPEOTEO QSERVEO

5 7.60 06 15.36 147 19.97 29

- 0 21.50 219 20.90 23

10 19.10 1011 16.76 1712 14.33 913 12.02 1214 9.96 1615 0.17 016 6.66 517 5.40

’3

10 22.10 17OR GREATER _

HIBER OF SESHENTS Fa.IO IS 200

HAXIHI! SEGHENT LEPGTH FaNO IS 31

CI-II-SMIARE HIT}! 14 OEOREES OF FREEDG! IS 12.0520 ·

OEGREES PRQABILITYOF FREEDQ1 992 952 7% 502 252 52 12

14 4.119 6.305 10.220 13.500 17.235 23.401 20.291

Page 84: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

80

¤·¤·¤-an GAP TEST eau-!

TESTI}6 SEEO: 105

BGIQS ARE 0.40000 TO 0.50000NIIBERS CHECKE0 ARE INOEXED FRG1 1 TO 5000GAPS REWESTE0 ARE 200 GAPS F0.N0 ARE_ 200INOEX OF LAST NIGER CHECKE0 IS 2006

GAP LHGTH PREDICTED GAPS NSERVEO GAPS

0 20.00 211 18.00 122 16.20 183 14.58 174 13.12 95 11.81 96 10.63 137 9.57 128 8.61 79 7.75 7

10 6.97 1211 6.28 612 5.65 913 50.84 48

OR GREATER

HAXINI1 GAP LE}G'TH FUND IS 67

THE CHI•SG.|ARE VALUE FOR 13 OEGREES OF FREEDGI IS 11.91840

OEGREES PRGABILITYOF FREEOG1 992 952 752 502 252 52 12

13 3.575 5.628 9.353 12.500 16.103 22.078 26.835

Page 85: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

81

¤·¤·¤u• PERNHATIUW TEST l-¤·¤·¤

TESTDW SEED: 105

THE INPUT $EQUE!¢E IS DIVIDED INTO 1666 ORGJPS OF 3 ELEHENTS EACH

THE HAXINI1 NIGER OF NIGERS TO BE TESTEO IS 4998

EXPECTE0 NIGER IN EACH INTERVAI. IS 277.67

CHI•5$JARE NITH 5 OEGREES OF FREEDGI IS 2.39015

DEGREES PR®ABILITYOF FREEDCH 992 952 752 502 252 52 12

5Q

0.554 1.146 2.675 4.351 6.626 11.070 15.090

Page 86: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

82

uu PQE! TEST an-¤·¤~¤ —

TESTINB SEED: 105

PQE! TEST OF 1000 GRGJPS.

F0!AG!¢I.|POF5N.kBE!S•HEA!ETESTIhU5|·|0|HANYA!ElI4IQIEINTHERANSE1T010

MPBER DIFFERENT PREOICTED OBSERVED

° 2 13 9’3 180 1626 506 5165 302 312

CHI•$UJARE FO! 3 DEGREES OF FREEOGI I3 3.96636

OEGREES PRGABILITYOF FREEDG1 992 952 7% 502 252 52 12

3 0.115 0.352 1.213 2.366 6.108 7.815 11.360

x

Page 87: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

83

¤·¤·¤·•• Pyß UP uu

TESTDG SEEO: 105

TABLE OF RUB UP822 RLNS OF LEMITH 1

1048 RINS OF LEPGTH 2462 RINS OF LENGTH 3121 RUS OF LENGTH 431 RUB OF LEWTH 5

9 RLNS OF LE}$TI·I 6 OR MR! .

THE HAXIHH RLN ts OF LEPGTH 7

CHI-SRIARE STATISTIC HITH 6 OEGREES OF FREEOGI IS 4.92993

OEGREES PRNABILITYOF FREEOQI 992 952 72 502 252 52 12

6 ·0.872 1.635 3.455 5.348 7.841 12.590 16.810

6

2

Page 88: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

84

una $¢R1A|, TE$1' mu;

TESTIW SEED: 105

M!BER$ CHECKEO ARE INOEXED FREI! 1 TO 5000

TESTINB PAIRS OF MIBERS (G•R) HHERE O AN0 R LIE BETNEEN 0 AN0 2

R R MllER IN CATE®RY

0 0 2780 1 2820 2 2981 0 - 3061 1 2581 2 2612 0 2612 1 . 2852 2 271

EXPECTE0 MRBER IN EACH CATEWRY IS 277.7

CI|I·$G.|ARE VALII FG 8 OEGREES OF FREEOGI IS 8.19568

OEOREES PRGABILITYOF FREEUGI 992 9% 752 502 252 52 12

8 1.646 2.733 5.071 7.344 10.220 15.510 20.090

\

Page 89: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

85

HH K·S 0000NES$·0F•FIT TEST ¤·¤·¤·¤

TESTIFG SEEOx 105 ·

MRBER OF MIQERS IN EACH KS TEST IS 500MRBER OF TESTS TO BE PERFORHED IS 5

BLNK 10 K-l

1 0.1068 0.7293 ·2 0.5212 0.4524 ·3 0.5717 0.40944 0.8560 0.25005 1.3029 0.3239

PRQABILITY IN Z 99 95 75 25 05 01

SAHPLE SIE 8 500 0.0642 0.1538 0.3726 0.8254 1.2163 1.5085

OVERALL DISTRIBUTIIN FORHED 8Y CGBINITB ALL PREVIGJS K• STATISTICS•AN0 ALL PREVIQIS K- STATISTICS AN0 GETTIBB A KS VALUE FOR EACH

001+ ¤ 0.3968 IK+)• • 0.4900(K—)+ 8 1.0377 (K-)- 8 0.2627

PRGABILITY IN Z 99 95 75 25 05 01

SAIPLE SIE 8 5 0.0215 0.0947 0.3249 0.7674 1.1400 1.4020

Page 90: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

86

llüä LISTINB läll

TESTING SEED: 256

LISTHG OF NIBERS IN DECIHAL• .

INDEX VALUE

1 0„390841961Z 0.41652369S3 O.6367967724 0.734953105

, 5 0.0667018896 0.15867728O ‘7 0.51186162Z8 0.70848089S9 0.074513972

10 0.31669586911 0.732418656 ·12 0.50448852813 0.59328270O14 O.Z5982832915 0.55182719216 0•25004625317 0•61930078318 0.17788618819 0.75509750820 0.73Z40977521 0.03921756122 0„580374181Z3 0„66962587824 O•11410099325 0,39990568Z .26 0.40407621927 0„37183904628 0.061830558 .29 0.61332386730 0„27356690231 0.94692021632 0.84874439Z33 0„26727783734 0.35346305435 O.44488364536 0.25063020O37 0.40334445Z38 0.1Z8S8378939 0.06964063640 0.12167710141 0.41903185842 0„29259747343 0.57405817S44 0.38879448Z45 0.01666820O46 0.98965513747 0.39722019448 0.57142770S

· 49 0.81582915850 0.499827683

Page 91: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

87

!·¤I·¤ Cl'II··$MJARE ¤·¤·¤··¤

TESTIW SEEO: 256

TEST OF 1000 NIBERS.NIGER OF INTERVALS ARE 100 • APPROXIHATE NIGER IN EACH INTERVAL ARE 10.00DEGREES OF FREEDGI ARE 99

SERJEDCE DEIN CHI-SGJARE

1 0.50010 86.8002 0.48232 112.0003 0.50665 100.6004 0.50025 76.0005 0.50568 64.200

DEGREES PRGABILITYOF FREEDGQ 992 952 752 502 252 52 12

99 68.558 76.764 89.254 98.500 108.202 122.942 133.852

\\

Page 92: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

. 88

älll CMRELATIG4 ·¤·I-ll

TESTIPG SEED: 256

CORRELATIMI TEST OF 4990 MIBERS. .

LAG CORRELAT1¤{

1 -0.008406792 0.006522933 0.008048084 ·-0.000146065 0.01461498 -6 -0.0].496273 ·7 0.016612808 0.014974599 —0.00099154

10 -0.02582010

Page 93: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

89

uu CRJPGI COLLECTOR HHTESTIFG SEEO: 256

NABER OF CRJPRI COLLECTOR SEGHENTS RERIESTED IS 200

UPPER BRN0 RI LEMTII OF SEGIENTS IS 50 ·

$E¤1EN‘TS HJST CRISISTS OF A CCHPLET! SET OF INTEOERS FRCI1 0 TO 6

HAXIHAI AHINT OF NIBERS AVAILABLE FOR TESTIPG IS 5000

LEPGTII DGECTEO GSERVEO

5 7.68 116 15.36 157 19.97 218 21.50 179 20.90 28

10 19.10 1811 16.76 1212 16.33 1113 12.02 15 416 9.96 1115 8.17 916 6.66 717 5.60 618 22.18 21

OR GREATER

MABER OF SEGHENTS FRAU IS 200

MAXIM}! SEGENT LENGTH FRN0 ISI

31

CHI-SRJARE NITH 16 OEGREES OF FREEOR! IS 8.6150 ·

OESREES‘

PRGABILITYOF FREE001 992 952 752 502 252 52 12

16 6.119 6.305 10.220 13.500 17.235 23.601 28.291

Page 94: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

90

um SAP TEST am-¤-1 ‘

TESTIIB SEED: 256

BMIIDS ARE 0.60000 TD 0.50000NIGERS CHECKED ARE INDEXED FROM 1 TO 5000GAPS REMJESTED ARE 200 GAPS FMNO ARE 200INDEX OF LAST NIGER CHECKED IS 2216

GAP LENSTH PREDICTED OAPS QSERVE0 OAPS

0 20.00 131 18.00 202 16.20 163 16.58 136 13.12 115 11.81 86 10.63 157 9.57 128 8.61 89 7.75 11

10 6.97 511 6.28 312 5.65 213 50.86 65

OR GREATER

MAXINI1 GAP LHGTH FMND IS 53

THE CHI-SGJARE VALUE FOR 13 DEOREES OF FREEDM1 IS 17.11011

DEGREES PRGABILITYOF FREEOMI 992 9% 752 502 252 52 12

13 3.575 5.628 9.353 12.500 16.103 22.078 26.835

1

1

Page 95: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

91

¤·I·¤·I PERMITATIGI TEST HH

TESTIN} SEEO: 256

THE INPUT SEGJEIWE IS OIVIDEO INTO 1666 GRQJPS OF 3 ELEHENTS EACH

THE MAXIM}! MIBER OF MIBERS TO BE TESTEO IS 4996

EXPECTE0 MRBER IN EAGH INTERVAL IS 277.67

CI·II•$G.IARE HITH 5 OESREES OF FREEO01 IS 5.65474

DEGREES PRGABILITYOF FREEDG4 992 952 752 502 252 52 12

5 0.554 1.146 2.675 4.351 6.626 11.070 15.090

Page 96: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

92

Il-!-I PGKER TEST l·¤·¤·¤

TESTI}8 SEEO: 256

PIXER TEST OF 1000 GRUJPS.”

FORAGRCIJPOF5NIGERS•HEARETESTIPGHO|HINYARElNI¤.JEINTHERANBE1TO10

NIGER OIFFERENT PREOICTEO QSERVEOu

2 13 63 180 1694 504 5045 302 320

CHI-SQJARE FOR 3 OEGREES OF FREEOG1 IS 5.94363

OEGREES PRIGABILITYOF FREEOGI 992 9% 7% 502 252 52 12

3 0.11.5 0.352 1.213 2.366 4.108 7.815 11.340

Page 97: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

93

man RIMS W es-an-¤-ne

TESTIPG SEED: 256

TABLE OF RUS W837 RIIB OF LE)6TH 1

1043 RLMS OF LEMGTH 2 '462 RIMS OF LEIGTH 3124 RIMS OF LEPGTH 429 RIMS OF LDGTH 5_ 7 RUS OF LEBGTH 6 OR FDRE

THE HAXIHM RIM IS OF LE!DTH 8

CHI-SGUARE STATISTIC HITH 6 OEGREES OF FREEDGI IS 43.13831

OEGREES PRGABILITYOF FREEOGI 992 92 72 502 252 52 12

6 0.872 1.635 3.455 5.348 7.841 12.590 16.810

Page 98: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

94

!!·|·l SERIAL TEST Hä!

TE$TI}6 SEED: 256

MIBERS CHECKE0 ARE INOEXED FRG1 1 TO 5000

TESTIM§ PAIRS OF MIBERS NMR) NHERE G AN0 R LIE BETHEEN 0 AN0 2

R R M}BER IN CATEGORY

0 0 · 277 .0 1 2700 2 2751 0 2721 1 2731 2 2682 0 2892 1 3092 2 267

EXPEOTED M!BER IN EACH CATEGORY IS 277.7

Cl·II•$¤JARE VALUE FOR 8 DEGREES OF FREE001 IS 5.17767

DEGREES · PRQABILITYOF FREEDG1 992 952 7% 502 252 % 12

8 1.646 2.733 5.071 7.344 10.220 15.510 20.090

Page 99: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

95

I·¤l·¤ K-S GOOONESS-OF-FIT TEST I-!-I-IU

TESTItG SEEOs 256”

NIGER OF NIGERS IN EACN KS TEST IS 500NIGER OF TESTS TO 8E PERFORHE0 IS 5

BLRK K6 K•

1 0.3533 0.7203·2 0.7764 0.65923 0.6808 · 0.70904 1.7256 0.03935 0.5196 0.6938

PRGABILITY IN Z 99u

95 75 25 05 01

SAHPLE SIE ¤ 500 0.0642 0.1538 0.3726 0.8254 1.2163 1.5085

OVERALL OISTRIBUTIINI FORHED BY CtIGINItß ALL PREVIUJS K•· STATISTICS•Ath ALL PREVIGS K- STATISTICS Ath 6ETTIt6 A KS VALUE FOR EACH

IKM• ¤ 0.2226 IKM-•

0.4941

IK-)+ = 0.7922 IK-)- ¤ 0.8512

PRGABILITY IN Z 99 95 75 25 05 01_ SAMPLE SIE ¤ 5 0.0215 0.0947 0.3249 0.7674 1.1400 1.4020

I

Page 100: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

96

III! LISTINQ nun!

TESTINS SEEOs 1111

LI$TI}G OF NIBERS IN 0ECIHAI„

INDEX VALUE

1 0„5160519482 0„2677651053 0„0118388914 0„5410059695 0„538861156 '

. 6 O.304962277 ·7 0•4968965058 0.0396954169 0„575797737

10 0.42422783411 0„20986217312 0„38043296313 O.44303327814 0„41264373115 0.186464667 .16 0.79322928Z17 0•12952607918 O„213333666·19 0.36214250320 0.57060354921 0•47892874522

‘0„611518979

23 0„85743939924 0„326536298 .25 0.86820304426 0„82800006927 0•14933252328 0•27216476229 0•90495204930 0.66332185331 0.406649768 ‘32 0„24632400333 0•77614510134 0„42077708235 0•10354840836 0.10325980Z37 0.73204720O38 0„69676500639 0.617429018 °* 40 0.66166704941 0.57138061S42 0.03494890043 0.29619294444 O.65943223245 0.16383469146 0.74384820S47 O.16855287648 0•91148668549 0.982124507 _50 0„504010499

Page 101: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

97

Vu-1-nur cI·|I·SQJARE ¤·¤·l·¤

TESTI}8 SEEO: 1111

TEST 0F 1000 NIGERS.NIGER 0F INTERVALS ARE 100 ; APPROXIHATE NIGER IN EACH INTERVAL ARE 10.00DEGREES 0F FREEDGI ARE 99

V

SERJEME HEAN CNI•SüIARE

1 0.50664 93.4002 0.51002 99.6003 0.50376 89. 0004 0.50445 93.8005 0.49812 102.000 ~

DEGREES PRGABILITYV

0F FREEDGl 992 952 752 502 252 52 12

99 68.558 76.764 89.254 98.500 108.202 122.942 133.852

Page 102: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

98” ‘

¤·¤•¤·•• CORRELATIG{ l·l·¤·I

TESTIM} SEEO: 1111 _

CORRELATIG4 TEST OF 4990 NIBERS.

LAG CORRELATIGI

1 0.006697552 0.006532273 0.004063466 •0.005260725 •0.005073926 0.011626487 0.009826678 » -0.006907899 0.00021667

10 0.02643738

Page 103: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

99

·I·¤·I·I CMQPON OOLLECTOR l-IM!

TESTIPG SEEO: 1111

MISER OF CMJPGI COLLEOTOR SEG1ENTS REMJESTEO IS 200

WPER BMND GI LEIBTH OF SEGMENTS IS 50

SEGIENTS HJST CMGISTS OF A CMPLETE SET OF INTEGERS FRGI 0 TO 4

HAXIMM AKINT OF MRBERS AVAILABLE FOR TESTIIG IS 5000

LEFGTII EXPECTE0 WSERVEO

5 7.68 66 15.36 127 19.97 148 21.50 219 20.90 24

10 19.10 20' 11 16.76 20

12 14.33 813 12.02 1314 9.96 · 915 8.17 1316 6.66 1117 5.40 618 22.18 23

OR GREATER

MIBER OF SEQIENTS FMN0 IS 200

HAXIMI1 SEQIENT LHGTII FMM0 IS 24

CHI-SMIARE HITH 14 OEGREES OF FREEOGI IS 12.7638

OEGREES PRQABILITYOF FREEDM4 992 952 752 502 252 52 12

14 4.119 6.305 10.220 13.500 17.235 23.401 28.291

Page 104: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

100

Ill-I GAP TEST ¤·¤·¤·••·

TESTIBG SEEO: 1111

Ba.NOS ARE 0.60000 T0 0.50000MIBERS CHECKE0 ARE INOEXED FRGI 1 TO 5000GAPS REQJESTEO ARE 200 GAPS FaN0 ARE 200INOEX OF LAST NABER CHECKE0 IS 1992

GAP LEFGTII PREOICTED GAPS GSERVEO GAPS

0 20.00 261 18.00 132 16.20 203 16.58 126 13.12 ~ 95 11.81 156 10.63 107 9.57 128 8.61 79 7.75 8

10 6.97 611 6.28 612 5.65 513 50.86 55

OR GREATER

HAXIHM GAP LEPGTH FaN0 IS 68

THE CIII•SaJARE VALUE FOR 13 OEGREES OF FREE001 IS 8.03572

OEGREES P&A8!LITYOF FREEOG1 992 952 752 502 252 52 12

13 3.575 5.628 9.353 12.500 16.103 22.078 26.835

w

Page 105: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

101

l·I·l·I PERIUTATIG4 TEST l-I-¤·l

TESTIN3 SEEO= 1111

THE INPUT SEMIHEE IS DIVIDED INTO 1666 GRGJPS OF 3 ELEHENTS EACH

THE HAXIHJ1 NIBER OF N}BERS TO BE TESTE0 IS 4998

EXPEOTEO NJBER IN EAOH INTERVAL IS 277.67

CHI•SGJARE NITH 5 OEGREES OF FREEOGI IS 2.35414

DEGREES PRQABILITYOF FREE001 992 . 952 752 502 252 52 12

5 0.554 1.146 2.675 4.351 6.626 11.070 15.090

Page 106: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

102

n-un-! PG<ER TEST aus-¤-n

TESTIN6 SEEO: 1111

P0(ER TEST OF 1000 GRGPS.

FORAGRIIJPOF5M)BER$•HEARETE$TIN3Hü|HANYARElNIG\JEINT)IERAI$E1TO10

MIBER OIFFERENT PREDICTE0 GSERVED

2 13 113 180 1756 506 5115 302 302

CHI-SQJARE FOR 3 OEGREES 0F FREEDG1 IS 0.73370

DEGREES PRQABILITY ‘OF FREEDCI1 992 952 752 502 252 52 12

3 0.115 0.352 1.213 2.366 6.108 7.815 11.360

Page 107: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

103

' uu Ruß UP uu

TESTDS SEEO: 1111

TABLE OF RUS UP835 RUS OF LEPSTH 1

1034 RUS OF LEPSTH 2459 RUS OF LEFSTH 3 r136 RUS OF LEISTH 4

23 RUS~OF LEISTH 510 HIS OF LDGTH 6 OR MRE

THE HAXIIII1 HN IS OF LEISTH 6

CHI·$HJARE STATISTIO HITH 6 OEGREES OF FREEDU1 IS 4.50122

OEGREES PRQABILITYOF FREEDGI 992 9% 752 502 252 52 12

6 0.872 1.635 3.455 5.348 7.841 12.590 16.810

Page 108: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

104

uu SERIAI. TEST••-H-!

TESTI}£ SEEO: 1111

NIGERS CHECXED ARE INOEXED FRGI 1 TO 5000

TESTDG PAIRS OF NIGERS (0•R) HHERE E AN0 R LIE BETHEEN 0 AND 2

O R NIGER IN CATENRY

0 D 2640 1 267 »0 2 2771 0 2841 1 2761 2 2702 0 2622 1 3012 2 299

EXPECTE0 NIGER IN EACII CATEGORY IS 277.7

CHI-SGJARE VALUE FOR 0 DEGREES OF FREEIIG1 IS 5.93397

DEBREES PRGABILITYOF FREEDG1 992 952 752 502 252 52 12

0 1.646 2.733 5.071 7.344 10.220 15.510 20.090

Page 109: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

105

*l*! K-S $0f¢SS-OF-FIT TEST III-I

uTESTU6 SEEO: 1111

NIGER OF NIGERS IN EACN KS TEST IS 500”

NIGER OF TESTS T0 BE PERFORHED IS 5INITIAL VALUE IS 1082399739

BLNK K+ K•

1 0.4580 0.54092 0.5661 0.79323 0.2333 0.86354 0.2372 0.79155 0.3912 0.5041

PRGABILITY IN Z 99 95 75 25 05 01

SAHPLE SIZE I 500 0.0642 0.1538 0.3726 0.8254 1.2163 1.5085

OVERALL UISTRIBUTIGI FDRHED BY CGGINIPG ALL PREVIGB K+ STATI$TIC$•AN0 ALL PREVIGJS K- STATISTICS AND GETTI!6 A KS VALIE FOR EACH

lK•l·• I 1.1781 (KH- I 0.2307

lK·l• I 0.5033 (K-l• I 0.8910

PRGABILITY IN Z 99 95 75 25 05 01

SAMPLE SIE I 5 0.0215 0.0947 0.3249 0.7674 1.1400 1.4020

Page 110: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

106

nenn L1$T1M6 nnen

TESTING SEED: 2049

LISTDG OF NJBERS IN 0ECIHAL•

INDEX VALUE

1 0•7324097752 0.0392175613 0„580374181 ·4 0„6642242675 0•1141009936 0.399923S637 0.220480621 '8 0.30361384Z9 0.114009619

10 0„88591104711 0„40675592412 0„07505053313 0„36469584714 0.00341910S15 O.34953790916 0„98285752517 0.78850561418 0„13018178919 0.37448513S20 0.10929185Z21 0.54787063622 0.030755907Z3 0„497530758 ·24 0„94845205525 0.07034456726 0.55174344827 0.02646931628 0.67351865829 0.73087322730 0,55866140l31 0•22160953332 0„541784227 -33 O.84503269234 0„12758463635 0.79131019l36 0.48060524537 O.36443859338 0.31180214939 0.321584344 .‘ 40 0.55683052S41 0„82294082642 0„30040639643 0•58586770344 0.490402997 ,45 O.29672229346 0•17082816447 0.51575243548 0.16367811049 0.47719401150 0.657904506

Page 111: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

107

ill! CHI•S$JARE ¤·¤·¤·!TESTDG SEEO: 2049

TEST OF 1000 NIGERS.NIGER OF INTERVALS ARE 100 ; APPROXIHATE NIGER IN EACH INTERVAL ARE 10.00DEGREES OF FREEOQ4 ARE 99

SERJEPCE HEAN CHI-SQJARE _1 0.49501 133.4002 0.48467 94.2003 0.48920 103.8004 0.51162 86.600 .5 0.46914 112.600

DEGREES PRQIBILITYOF FREEDGI 992 952 752 502 252 H 12

99 68.558 76.764 89.29 98.500 108.202 122.942 133.852

Page 112: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

108

l·I·I·l CORRELATIGI ¤·¤·!·I

TESTUG SEED: 2049

CORRELATIGI TEST 0F 4990 MIBERS.

LAB CORIIELATIGO

1 . 0.002896102 -0.013114183 •0.004334934 0.003642645 0.018498736 0.026816287 •0.007206078 -0.005737349 •0.01216364

10 0.03087859

Page 113: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

109

ll·l* Cüßül COLLECTOR I·¤¤·l·

TESTUG SEEO: 2049

MEER OF CüJPü| COLLECTOR SEGHENTS REQJESTED IS 200 uUPPER SüNO GI LHGTII OF SEQENTS IS 50

SEGIENTS HST CGSISTS OF A CCHPLETE SET OF INTEGERS FRGI 0 TO 4HAXIHJ1 AFUNT OF MIBERS AVAILABLE FOR TESTIIG IS 5000 ·

LEFSTH EXPEOTEO QSERVEO

5 7.68 66 15.36 . 147 19. 97 218 21.50 159 20.90 16

10 19.10 _ 18° 11 16.76 1512 14.33 23* 13 12.02 16 —14 9.96 915 8.17 916 6.66 517 5.40 518 22.18 28

_ OR OREATER '

N|BER OF SEGHENT8 Füll IS 200 'HAXIPIM SEQ1ENT LEPGTII FüNO IS 40

CHI-SWARE HITII 14 OEGREES OF FREEDG1 IS 12.6193

OEGREES PRGASILITYOF FREEDG1 992 952 752 502 252 52 12

14 4.119 6.305 10.220 13.500 17.235 23.401 28.291

Page 114: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

110

'a¤·¤·••·¤ GAP TEST wu ‘

TESTIPß SEED: 2049

BUNDS ARE 0.40000 TO 0.50000NIGERS CHECKED ARE INDEXED FRU1 1 TO 5000GAPS REQUESTE0 ARE 200 GAPS FUND ARE 200INDEX OF LAST NIGER CHECKED IS 2313

GAP LEWTH PREDICTED GAPS GSERVED 0APS

0 20.00 151 10.00 172 16.20 153 14.50 64 13.12 10

’5 „ 11.01 106 10.63 107 9.57 160 0.61 69 7.75 9

10 6.97 911 6.20 612 5.65 013 50.04 57

OR OREATER

HAXINN GAP LE}S'I’H FUND IS 73

THE CHI•$UIARE VALUE FOR 13 DEGREES OF FREEDGI IS 17.09590

DEGREES PRGABILITYOF FREEDU1 992 952 752 502 252 52 12

13 3.575 5.620 9.353 12.500 16.103 22.070 26.035

Page 115: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

111

uu PERNITATION TEST MH

TESTINB SEEO: 2049

THE INPUT SEQJENSE IS OIVIOED INTO 1666 GRGJPS OF 3 ELEHENTS EACHTHE HAXINI1 NIGER OF NIGERS TO BE TESTE0 IS 4998

INITIAL VALUE IS 1086029621

EXPECTE0 NIGER IN EAOH INTERVAL IS 277.67

CHI-SGJARE NITH 5 OEGREES OF FREE001 IS 7.69868

OEGREES PRQABILITTOF FREEDQ1 992 9% 7% 502 252 52 12

5 0.554 1.146 2.675 4.351 6.626 11.070 15.090

Page 116: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

112A

_ wu PQE! TEST uu

TESTD6 SEEO: 2069

PG<ER TEST OF 1000 ORGPS.

FORAORü|POF5N.I'B£R$•HEARETE$TI!6HOIHANYARElIl!¤.IE INTHERAIGEITOIO

NJBER IIIFFERENT PREIIICTE0 QSERVEO

2 13 103 180 1656 506 5275 302 297

CHI-SGJARE FOR 3 DEOREES OF FREEDG1 IS 3.36897

OEGREES PRGABILITYOF FREEDG1 992 952 752 502 252 52 12

3 0.115 0.352 1.213 2.366 6.108 7.815 11.360

Page 117: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

113

lll-I Ruß UP uu

TESTIPG $EEOz 2049

TABLE OF RLNS UP893 RLNS OF LEPGTH 1

1035 RUB OF LEPGTH 2457 RLNS OF LEIGTH 3

· 129 RUS OF LEISTH 425 RUS OF LEFGTH 5 - -4 RLNS OF LENOTH 6 OR MR!

THE HAXIPIH RIM IS OF LEPGTH 6

CHI·$$|ARE STATISTIO HITH 6 OEOREES OF FREEDGQ IS 6.45667

DEBREES PRGABILITYOF FREEDG1 992 952 7§¢ 502 252 52 12

6 0.872 1.635 3.455 5.346 7.841 12.590 16.810

Page 118: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

114

HN SERIAL TEST ¤·¤-¤-¤

TESTITG SEEO: 2049

MIBERS CHECKE0 ARE INUEXEO FRG1 1 TO 5000TESTIPG PAIRS OF MRBERS lG•R) NIIERE O ANO R LIE BETHEEN 0 AN0 2

_ O R M!8ER IN CATEGORY

0 0 3010 1

“319

0 2 2741 0 3091 1 2471 2 2682 0 2552 1 2672 2 260

EXPECTE0 MIBER IN EACN CATE®RY I3 277.7

CHI-SGJARE VALUE FOR 8 OEGREES OF FREE001 IS 18.80551

OEGREES PRWABILITYOF FREE001 992 952 752 502 E2 52 12

8 1.646 2.733 5.071 7.344 10.220 15.510 20.090

Page 119: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

115

I·I·¤·¤ I<·S G00¤NES$-0F-FIT TEST an-¤-uu

TESTIIG SEE02 2049

MRBER OF MIBERS IN EACH KS TEST IS 500,

MRBER OF TESTS T0 BE PERFORHEI) IS 5

BL®KK• K-

1 0.9221 0.55382 0.6737 0.73173 1.4627 0.24014 0.7168 0.70955 1.1265 0.2042

PRQABILITY IN Z 99 95 75 25 05 01

SAHPLE SIZE I 500 0.0642 _ 0.1538 0.3726 0.82.54 1.2163 1.5085

OVERALL DISTRIBUTIQI FORHEI) BY CGBINIIG ALL PREVIGS K+ STATISTIC$•‘ANO ALL PREVIOUS K- STATISTICS ANO GETTIIG A KS VALUE FOR EACII _

IK•)• I 0.0310 IK+)• I 1.3340IK- )• • 0.7665 IK-)- I 0.1789

PRGABILITY IN Z 99 95 75 25 ' 05 01

SAHPLE SIZE I 5 0.0215' 0.0947 0.3249 0.7674 1.1400 1.4020

Page 120: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

116

anna LISTING anna

TESTING SEED: 9604

LISTDG OF MIBERS IN 0ECINAL„

INDEX VALUE_ 1 0„007854193

2 D.205505967 ~3 0„1620266444 0.404001892 '5 0.602327168

’6 0•7247222667 0.3908419618 0„4165Z64379 0„636796772

10 0.73495310S11 0•066701889 _12 0•15867728013 0.51186162Z14 0.70848089S15 0.07451397216 0.31669586917 0.54885542418 0•504488051 ·19 0.59328270O20 0„25982832921 0.55182719Z22 0•2$004625323 0„61930078324 0•17788618825 0„755103Z9026 0.10164433727 0.058945104 .28 0.69314074S29 0.71894425Z30 0„50B40085731 0.43451261S32 0•404076Z1933 0.41090154634 0.06183056Z35 0.38676130B36 0.27344483l37 0.94692021638 0.84874439Z39 0.26727783740 0•35346305441 0.44488251Z42 0„25063020043 O.43409729044 0.35356885Z45 0.05072474l46 0.99190127847 0.04450250048 0.35084784049 0.80843317S50 0„011271026

Page 121: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

A 117

lll! C)|I·$QUARE HHTESTIPG SEEO: 9604

TEST OF 1000 NJFBERS.V

MIBER OF INTERVALS ARE 100 • APPROXIHATE N)BER IN EACH INTERVAL ARE 10.00

DEGREES OF FREEOG‘I ARE 99

SEQJEYCE !£AN CHI•Sü|ARE

1 0.51692 122.4002 0.50997 108. 2003 0.49458 68.8004 0.50295 91.4005 0.49580 106.000

OEGREES PRQABILITY0F FREEDG4 992 952 752 502 252 52 12

99 68.558 76.764 89.254 98.500 108.202 122.942 133.852

Page 122: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

118

' Füll CORRELATICN ¤·¤·¤-¤TESTNG SEED: 9604

CORRELATICN TEST 0F 4990 NJBERS.LAG CORRELATIGI

1 4.004501762 0.037747003 -0.0].7318184 0.018577725 4.013338086 0.002590197 -0.003233838 0.018110589 -0.0258668B

10 4.0211659

Page 123: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

119

I—I·I·l CGJPG4 COLLECTOR ¤·¤·¤·¤

TESTIFG SEEO: 9606

MIBER OF CGJPCN COLLECTOR SEGMENTS REINESTEO IS 200

UPPER BGIO GI LE}6’|'I·| OF SEQIENTS IS 50

SE¤1EN'|'S MST CGSISTS OF A CIHPLETE SET OF INTEGE3 FRG1 0 TO 6

MAXIM]! MUNT OF NIBE3 AVAILABLE FOR TESTDB IS 5000

LE}8TH EXPEOTE0 NSERVEII

5 7.68 36 15.36 187 19.97 158 21.50 209 20.90 28

10 19.10 1611 16.76 12 ·12 16.33 1813 12.02 2016 9.96 815 8.17 1016 6.66 617 5.60 618 22.18 22 .

OR SREATER

MRBER OF $EGlEN‘I'S FGIII IS 200

HAXIHI4 SE§1ENT LE}6I’I| FGRII IS 37

CHI·$M|ARE HITH 16 OEOREES OF FREEOGI IS 17.0716

DEOREES PRGABILITYOF FREEDCH 992 952 752 502 252 52 12

- 16 6.119 6.305 10.220 13.500 17.235 23.601 28.291

Page 124: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

120

••·¤-A-!GAP 1’E$T nasse

TESTI!ß SEEO: 9604

8<I.NOS ARE 0.40000 TO 0.50000MIBERS CHECKE0 ARE INOEXEO FRG1 1 TO 5000GAPS REOUESTEO ARE 200 GAPS FOLN0 ARE 200INOEX OF LAST MJBER CHECXE0 IS 2072

GAP LEPGTH PREOIOTEO GAPS GSERVE0 GAPS

0 20.00 251 18.00 142 16.20 123 14.58 15

. 4 13.12 135 11.81 86 10.63 87 9.57 168 8.61 79 7.75 7

10 6.97 811 6.28 612 5.65 413 50.84 57

OR GREATER

HAXIHM GAP LEIGTH FUND ISI

54

THE CHI·$GJARE VALUE FOR 13 OEGREES OF FREEDGI IS 11.21235

DEGREES PRQABILITYOF FREEOGI 992 952 752 502 252 52 12

13 3.575 5.628 9.353 12.500 16.103 22.078 26.835

Page 125: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

121.

I·I·l·I PERIIJTATICN TEST ¤·|*!

TESTIIG SEEO: 9604

THE INPUT SEMJENZE IS OIVIDEO INTO 1666 GRGJPS OF 3 ELEHENTS EACH

THE HAXINI1 NIGER OF NIGERS TO BE TESTEO IS 4998

EXPECTED NIGER IN EACH INTERVAL IS 277.67

CHI•SQJARE HITH 5 DEGREES OF FREEDG1 IS 7.38896

OEGREES PRGABILITYOF FREEDCI1 992 952 752 502 252 52 12

5 0.554 1.146 2.675 4.351 6.626 11.070 15.090

Page 126: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

122 .

¤·l·I·I PGKER TEST l·¤·I-¤ ~

TESTI}6 SEEO: 9604

PG(ER TEST OF 1000 GRGJPS.u

FORA6RüJPOF5MIBER$•HEARETESTIP8|·I01HANYAREl.NI¤JEINTHERAMBE1T010

M.\BER OIFFERENT PREOICTEO QSERVEO

' 2 13 163 100 1824 504 4925 302 309

C!|I·SQJARE FOR 3 OEBREES OF FREEOGQ IS 0.07552

OEGREES ' _ _ FRNABILITY _OF FREE001 992 952 752 502 252 52 12

3 0.115 0.352 1.213 2.366 4.108 7.815 11.340

Page 127: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

123 _

TESTUG SEED: 9604

TABLE OF RLNS UP ·802 Riß OF LENBTH 11107 RLNS OF LEPGTH 2430 RLNS OF LEIGTH 3124 RINS OF LEFGTH 4

25 RUNS OF LEFGTH 5' 12 Riß OF LEPGTH 6 OR IORE

THE HAXIPIMRLNIS OF LENBTH 6 -

CHI—$GJARE STATISTIC NITH 6 OEGREES OF FREE001 IS 15.25854

OEGREES PRQABILITYOF FREEDQI 992 952 752 502 252 52 12

6 0.872 1.635 3.455 5.348 7.841 12.590 16.810

Page 128: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

124

nur SERIAL TEST ***••

TESTIPB SEED: 9604u

MIBERS CHECKE0 AR! INOEXED FR01 1 TO 5000

TESTIPG PAIRS OF MIBERS (9•R) HIER! R AN0 R LI! BETNEEN 0 AND 2

E R MIBER IN CATEGORY

0 0 269. 0 1 278

0 2 2791 0 2771 1 2641 2 2922 0 2812 1 2742 2 286

EXPEBTE0 MISER IN EACH CATEGORY IS 277.7

C}II•$GJARE VALUE FOR 8 DEGREES OF FREEDGI IS 2.03001

DEGREES PRGABILITY _ _OF FREEDGI 992 952 752 502 252 52 12

8 1.646 2.733 5.071 7.344 10.220 15.510 20.090

Page 129: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

125

- ***8 K-S GXIONE$$·OF-FIT TEST l·I·I-I

TESTI}G SEEO: 9606

NIGER OF NIGERS IN EACH KS TEST IS 500NIGER OF TESTS TO BE PERFORHED IS 5INITIAL VALUE IS 1059072952

BLOCK Ke K-

1 0.2060 1.07672 0.5865 1.18993 0.2013 0.72736 0.3689 1.01615 0.5223 0.5969

PRGABILITY IN Z 99 95 75 5 05 01

SAHPLE SIZE 8 500 0.0662 0.1538 0.3726 0.856 1.2163 1.5085

OVERALL DISTRIBUTIGI FORHED BY CGBININE ALL PREVIGS Ke STATISTICS»AN0 ALL PREVIGB K- STATISTIOS AN0 GE'I'TI}£ A KS VALUE FOR EACN

(K•)+ 8 1.1238 (Ke)- 8 0.1760(K-)e I 0.1317 IK-)- 8 1.1362

PR5A8ILITY IN Z 99 95 75 25 05 01

SAPPLE SIZE 8 5 0.0215 0.0967 0.3269 0.7676 1.1600 1.6020

Page 130: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

126

aaa! LISTINQ anna

TESTING SEED: 32767

LISTDG 0F NJBERS IN DECIHAI„

INUEX VALUE

1 0.40421551S“

2 0.6020525103 0„7247222664 0.39084196l .5 0.4165236956 0.63679677Z7 0.73495310S8 0„066701889 -9 0•158677Z80

10 0.51186162211 0.70848089S12 0.07451397Z13 0„316695869 .14 0„54885542415 0.50448805116 0•59328270017 0.Z5982737518 0.551827192

. 19 O.25004625320 0„61930078321 0.17788618822 0.75509750823 0.73240977524 0„03921756125 0.58233141926 0.71894425Z27 0.508400857 A28 0.43451261529 0.40407621930 0.37183904631 0.06183056Z32 0„38676130833 0•27344483134 0„94692021635 0.84898853336 O.26727783737 0•35346305438 0.44488251Z39 O.25063020040 O.43459445241 0.12858378942 0„00714062543 0.62471270644 0•04450357345 0.35084784O46 0.80843317547 0.38879448Z48 0.01666820O ‘49 0.98965811750 0„682146668

Page 131: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

127

HH CI|I•S!IUARE HH

TESTINB SEED: 32767

TEST OF 1000 NIGERS.NIGER OF INTERVALS ARE 100 • APPROXIHATE NIGER IN EACH INTERVAL ARE 10.00

OEGREES OF FREEDCI1 ARE 99

SEQJENZE HEAN CI·II•$$JARE

1 0.50663 110.8002 0.69959 90.2003 0.50655 90.8006 0.50831 _ 96.0005 0.60721 91.000

OEGREES PRQABILITY‘ OF FREEDCI1 992 952 752 502 252 52 12

99 68.558 76.766 09.256 98.500 108.202 }122.962 133.052

Page 132: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

128

uu CORRELATIIXI ¤·¤*¤

TESTING SEEDx 32767

CORRELATION TEST OF 4990 NUHBERS. .

LAG CORRELATION

1 0.00821742 ·2 -0.009676233 -0.004268164 •0.005226455 0.010805356 -0.013049757 -0.019792168 -0.008883719 0.00713297

10 0.02115792

Page 133: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

9 129

um CNPGJ COLLECTOR HH

TESTIFG SEED: 32767

NIGER OF CGJPGI COLLECTOR SEGENTS REGJESTEO IS 200

UPPER BGI40 G4 LE}G‘?|| OF SEGIENTS IS 50

SEGIENTS NST CGSISTS OF A CGWLETE SET OF INTEGERS FRG1 0 TO 6

HAXINI1 ANLN? OF NIGERS AVAILABLE FOR TESTIPG IS 5000

LEFSTH EXPECTE0 GSERVED

5 7.68 56 15.36 217 19.97 198 21.50 179 20.90 20

10 19.10 2311 16.76 1512 16.33 1113 12.02 - 1116 9.96 415 8.17 1216 6.66 5-17 5.60 618 22.18 31

OR GREATER

NIGER OF SEGHENTS FGIIO IS 200

HAXINI1 SEGEN'? LE$‘?l·| FGIII IS 36

CHI-SQJARE HITH 16 OEGREES OF FREEOG1 IS 15.2ßS

OEGREES PRQABILITYOF FREEOG1 992 952 752 502 252 52 12

16 6.119 6.305 10.220 13.500 / 17.235 23.601 28.291

Page 134: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

130U uu GAP TEST wwwTESTIIS SEED: 32767

80.NOS ARE 0.60000 TO 0.50000IARBERS CHECKED ARE INDEXED FROM 1 TO 5000GAPS REOUESTED ARE 200 GAPS FUND ARE 200INDEX OF LAST NIGER CHECKED IS 2077

GAP LEISTH PREDICTED GAPS GSERVED GAPS ·

0 20.00 261 18.00 122 16.20 193 14.58

”13

4 13.12 145 11.81 · 86 10.63 87 9.57 5

- 8 8.61 119 7.75 7 ‘

10 6.97 1211 6.28 312 5.65 513 50.84 59

OR GREATER

MAXINM GAP LEPGTH FQND IS 53

THE CHI·$ü.|ARE VALUE FOR 13 DEGREES OF FREEDG1 IS 15.02692 ‘

DEGREES PRGABILITY0F FREEDGI 992 952 752 502 252 52 12

13 3.575 5.628 9.353 12.500I

16.103 22.078 26.835

I

Page 135: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

131

lll-! PERNJTATIDN TEST ¤·¤-¤·••

TESTINB SEE|Jz 32767

THE INPUT SEQJENZE IS OIVIOEO INTO 1666 ORGJPS OF 3 ELEHENTS EACH

THE HIXINI1 NIGER OF NIGERS TO BE TESTE0 IS 4998

EXPEOTE0 NIGER IN EACH INTERVAL IS 277.67

CHI·$OUARE NITH 5 OEGREES OF FREEOGI IS 4.06843

DEBREES PRQABILITYOF FREEDG1 992 952 752 502 252 52 12

5 0.554 1.146 2.675 ) 4.351 6.626 11.070 15.090

Page 136: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

132

I·l·!I PCXER TEST l*¤·I

TESTIIG SEED: 32767

PG<ER TEST OF 1000 GRGPS.

FORAGRGJPOF5NIGERS•!¢ARETESTI}8|IülHANYARE\III$JE INTHE RANSE 1TO10

NIGER OIFFERENT PREDIOTEO NSERVEO

2 13 133 180 1884 504 5145 302 284

CHI-SOUARE FOR 3 OEOREES OF FREEOIII IS 1.70000

4 OEGREES PRQABILITYOF FREEOCII 992 99 79 502 252 52 12

3 0.115 0.352 1.213 I 2.366 4.108 7.815 11.340

Page 137: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

133

uu RUS W an-na-!

TESTUS SEEO: 32767

TABLE OF RUS UP858 RUS OF LEMFTH 1

1052 RUS OF LEPGTH 2472 RUS OF LHGTH 3118 RUS OF LEMTH 4

26 RUS OF LEHBTH 53 RUS OF LEIGTH 6 OR FDRE

' THE MAXIM}! RUI IS OF LEIGTH 7

CN!-·$|IUARE STATISTIO HITH 6 OEGREES OF FREEDQI IS 6}45361

DEGREES PRQABILITYOF FREEDUI 992 9% 752 502 252 52 12

6 0.872 1.635 3.455 5.348 T 7.841 12.590 16.810

Page 138: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

A 134

uu SERIAL TESTl·¤·¤·••

TESTIFG SEEO: 32767

MIBERS CHECKE0 ARE INOEXED FRG1 1 TO 5000

TESTIFG PAIRS OF MIBERS [MR) NHERE R AN0 R LIE BETHEEN 0 AND 2

G R MRBER IN CATEGORY'

0 0 2800 1 2690 2 2981 0 2711 1 2771 2 2782 0 2742 1 2872 2 266

EXPECTED MIBER IN EACII CATEGORY IS 277.7

CHI-SGJARE VALUE FOR 8 OEFREES OF FREEOGl IS 2.79352

DEGREES PRGABILITYOF FREEDCH 992 952 752 502 252 52 12

_ 8 1.646 2.733 fl 5.071 7.344 10.220 1.5.510 20.090

Page 139: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned

135

HH K-S GOODNESS-0F•FI1’ TEST HH

TESTIIG SEEOs 32767

NJBER OF NJPBERS IN EACH KS TEST IS 500NJBER OF TESTS TO BE PERFORIED IS 5

BL$K K9 K•

ä 3‘ä§ää 31523s olaazs 0:5ä7I>4 0.5054 0.44545 0.6341 0.5312

PRGABILITY IN Z 99 95 75 25 05 01SAHPLE SIZE I 500 0.0642 0.1538 { 0.3726 0.8254 1.2163 1.5085

' OVERALL OISTRIBUTIGI FORHED BY CGBINITS ALL PREVIIIJS K+ STATISTICS»AND ALL PREVIOUS K- STATISTICS GETTITS A KS VALUE FOR EACHIK+)• I 1.0005 lK•!- I 0.3852IK-l• I 0.5620 IK-)- I 0.7323

PRQABILITY IN'Z 99 95 75 E · 05 01SAHPLE SIZE I 5 0.0215 0.0947 0.3249 , 0.7674

{ 1.1400 1.4020

Page 140: A PORTABLE C RANDOM NUMBER GENERATOR...ble. Generator 1 is used to calculate a random value. Gen-erator 2 is then used to index into the table. The value in the table location is returned