Vous êtes sur la page 1sur 12

1

2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80

NOTE: Most of the tests in DIEHARD return a p-value, which


should be uniform on [0,1) if the input file contains truly
independent random bits.
Those p-values are obtained by
p=F(X), where F is the assumed distribution of the sample
random variable X---often normal. But that assumed F is just
an asymptotic approximation, for which the fit will be worst
in the tails. Thus you should not be surprised with
occasional p-values near 0 or 1, such as .0012 or .9983.
When a bit stream really FAILS BIG, you will get p's of 0 or
1 to six or more places. By all means, do not, as a
Statistician might, think that a p < .025 or p> .975 means
that the RNG has "failed the test at the .05 level". Such
p's happen among the hundreds that DIEHARD produces, even
with good RNG's. So keep in mind that " p happens".
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
This is the BIRTHDAY SPACINGS TEST
::
:: Choose m birthdays in a year of n days. List the spacings
::
:: between the birthdays. If j is the number of values that
::
:: occur more than once in that list, then j is asymptotically
::
:: Poisson distributed with mean m^3/(4n). Experience shows n
::
:: must be quite large, say n>=2^18, for comparing the results
::
:: to the Poisson distribution with that mean. This test uses
::
:: n=2^24 and m=2^9, so that the underlying distribution for j ::
:: is taken to be Poisson with lambda=2^27/(2^26)=2. A sample
::
:: of 500 j's is taken, and a chi-square goodness of fit test
::
:: provides a p value. The first test uses bits 1-24 (counting ::
:: from the left) from integers in the specified file.
::
::
Then the file is closed and reopened. Next, bits 2-25 are
::
:: used to provide birthdays, then 3-26 and so on to bits 9-32. ::
:: Each set of bits provides a p-value, and the nine p-values
::
:: provide a sample for a KSTEST.
::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
BIRTHDAY SPACINGS TEST, M= 512 N=2**24 LAMBDA= 2.0000
Results for rng.32
For a sample of size 500:
mean
rng.32
using bits 1 to 24
1.938
duplicate
number
number
spacings
observed
expected
0
63.
67.668
1
144.
135.335
2
143.
135.335
3
91.
90.224
4
40.
45.112
5
10.
18.045
6 to INF
9.
8.282
Chisquare with 6 d.o.f. =
5.55 p-value= .524026
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500:
mean
rng.32
using bits 2 to 25
2.010
duplicate
number
number
spacings
observed
expected
0
71.
67.668
1
131.
135.335
2
130.
135.335
3
100.
90.224
4
40.
45.112
5
17.
18.045
6 to INF
11.
8.282
Chisquare with 6 d.o.f. =
3.10 p-value= .204383
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500:
mean
rng.32
using bits 3 to 26
2.008
duplicate
number
number
spacings
observed
expected
0
68.
67.668
1
146.
135.335
2
126.
135.335
3
83.
90.224
4
42.
45.112
5
24.
18.045
6 to INF
11.
8.282
Chisquare with 6 d.o.f. =
5.14 p-value= .473574
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500:
mean
rng.32
using bits 4 to 27
1.978
duplicate
number
number
spacings
observed
expected
0
68.
67.668
1
139.
135.335
2
133.
135.335

81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160

3
94.
90.224
4
37.
45.112
5
20.
18.045
6 to INF
9.
8.282
Chisquare with 6 d.o.f. =
2.03 p-value=
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500:
rng.32
using bits 5 to 28
duplicate
number
number
spacings
observed
expected
0
64.
67.668
1
135.
135.335
2
122.
135.335
3
103.
90.224
4
47.
45.112
5
23.
18.045
6 to INF
6.
8.282
Chisquare with 6 d.o.f. =
5.39 p-value=
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500:
rng.32
using bits 6 to 29
duplicate
number
number
spacings
observed
expected
0
70.
67.668
1
138.
135.335
2
137.
135.335
3
85.
90.224
4
50.
45.112
5
12.
18.045
6 to INF
8.
8.282
Chisquare with 6 d.o.f. =
3.02 p-value=
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500:
rng.32
using bits 7 to 30
duplicate
number
number
spacings
observed
expected
0
68.
67.668
1
147.
135.335
2
141.
135.335
3
70.
90.224
4
50.
45.112
5
19.
18.045
6 to INF
5.
8.282
Chisquare with 6 d.o.f. =
7.66 p-value=
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500:
rng.32
using bits 8 to 31
duplicate
number
number
spacings
observed
expected
0
68.
67.668
1
148.
135.335
2
139.
135.335
3
86.
90.224
4
41.
45.112
5
12.
18.045
6 to INF
6.
8.282
Chisquare with 6 d.o.f. =
4.51 p-value=
:::::::::::::::::::::::::::::::::::::::::
For a sample of size 500:
rng.32
using bits 9 to 32
duplicate
number
number
spacings
observed
expected
0
58.
67.668
1
132.
135.335
2
144.
135.335
3
85.
90.224
4
63.
45.112
5
12.
18.045
6 to INF
6.
8.282
Chisquare with 6 d.o.f. =
12.07 p-value=
:::::::::::::::::::::::::::::::::::::::::
The 9 p-values were
.524026
.204383
.473574
.083268
.193656
.735751
.392273
.939518
A KSTEST for the 9 p-values yields .147832

.083268
mean
2.054

.505320
mean
1.954

.193656
mean
1.932

.735751
mean
1.888

.392273
mean
2.048

.939518
.505320

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
THE OVERLAPPING 5-PERMUTATION TEST
::

161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240

:: This is the OPERM5 test. It looks at a sequence of one mill- ::


:: ion 32-bit random integers. Each set of five consecutive
::
:: integers can be in one of 120 states, for the 5! possible or- ::
:: derings of five numbers. Thus the 5th, 6th, 7th,...numbers
::
:: each provide a state. As many thousands of state transitions ::
:: are observed, cumulative counts are made of the number of
::
:: occurences of each state. Then the quadratic form in the
::
:: weak inverse of the 120x120 covariance matrix yields a test
::
:: equivalent to the likelihood ratio test that the 120 cell
::
:: counts came from the specified (asymptotically) normal dis::
:: tribution with the specified 120x120 covariance matrix (with ::
:: rank 99). This version uses 1,000,000 integers, twice.
::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
OPERM5 test for file rng.32
For a sample of 1,000,000 consecutive 5-tuples,
chisquare for 99 degrees of freedom= 73.825; p-value= .027474
OPERM5 test for file rng.32
For a sample of 1,000,000 consecutive 5-tuples,
chisquare for 99 degrees of freedom= 85.351; p-value= .165793
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: This is the BINARY RANK TEST for 31x31 matrices. The leftmost ::
:: 31 bits of 31 random integers from the test sequence are used ::
:: to form a 31x31 binary matrix over the field {0,1}. The rank ::
:: is determined. That rank can be from 0 to 31, but ranks< 28
::
:: are rare, and their counts are pooled with those for rank 28. ::
:: Ranks are found for 40,000 such random matrices and a chisqua-::
:: re test is performed on counts for ranks 31,30,29 and <=28.
::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Binary rank test for rng.32
Rank test for 31x31 binary matrices:
rows from leftmost 31 bits of each 32-bit integer
rank
observed expected (o-e)^2/e sum
28
245
211.4 5.334218
5.334
29
4986
5134.0 4.267042
9.601
30
23180
23103.0
.256320
9.858
31
11589
11551.5
.121579
9.979
chisquare= 9.979 for 3 d. of f.; p-value= .982047
-------------------------------------------------------------:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: This is the BINARY RANK TEST for 32x32 matrices. A random 32x ::
:: 32 binary matrix is formed, each row a 32-bit random integer. ::
:: The rank is determined. That rank can be from 0 to 32, ranks ::
:: less than 29 are rare, and their counts are pooled with those ::
:: for rank 29. Ranks are found for 40,000 such random matrices ::
:: and a chisquare test is performed on counts for ranks 32,31, ::
:: 30 and <=29.
::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Binary rank test for rng.32
Rank test for 32x32 binary matrices:
rows from leftmost 32 bits of each 32-bit integer
rank
observed expected (o-e)^2/e sum
29
203
211.4
.335179
.335
30
5124
5134.0
.019518
.355
31
23038
23103.0
.183140
.538
32
11635
11551.5
.603225
1.141
chisquare= 1.141 for 3 d. of f.; p-value= .375543
-------------------------------------------------------------$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: This is the BINARY RANK TEST for 6x8 matrices. From each of ::
:: six random 32-bit integers from the generator under test, a
::
:: specified byte is chosen, and the resulting six bytes form a ::
:: 6x8 binary matrix whose rank is determined. That rank can be ::
:: from 0 to 6, but ranks 0,1,2,3 are rare; their counts are
::
:: pooled with those for rank 4. Ranks are found for 100,000
::
:: random matrices, and a chi-square test is performed on
::
:: counts for ranks 6,5 and <=4.
::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Binary Rank Test for rng.32
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG rng.32
b-rank test for bits 1 to 8
OBSERVED
EXPECTED
(O-E)^2/E
SUM
r<=4
954
944.3
.100
.100
r =5
21737
21743.9
.002
.102
r =6
77309
77311.8
.000
.102
p=1-exp(-SUM/2)= .04968
Rank of a 6x8 binary matrix,

241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320

rows formed from eight bits of the RNG rng.32


b-rank test for bits 2 to 9
OBSERVED
EXPECTED
(O-E)^2/E
r<=4
943
944.3
.002
r =5
21725
21743.9
.016
r =6
77332
77311.8
.005
p=1-exp(-SUM/2)= .01168
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG rng.32
b-rank test for bits 3 to 10
OBSERVED
EXPECTED
(O-E)^2/E
r<=4
961
944.3
.295
r =5
21488
21743.9
3.012
r =6
77551
77311.8
.740
p=1-exp(-SUM/2)= .86781
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG rng.32
b-rank test for bits 4 to 11
OBSERVED
EXPECTED
(O-E)^2/E
r<=4
956
944.3
.145
r =5
21745
21743.9
.000
r =6
77299
77311.8
.002
p=1-exp(-SUM/2)= .07091
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG rng.32
b-rank test for bits 5 to 12
OBSERVED
EXPECTED
(O-E)^2/E
r<=4
972
944.3
.812
r =5
21758
21743.9
.009
r =6
77270
77311.8
.023
p=1-exp(-SUM/2)= .34434
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG rng.32
b-rank test for bits 6 to 13
OBSERVED
EXPECTED
(O-E)^2/E
r<=4
933
944.3
.135
r =5
21689
21743.9
.139
r =6
77378
77311.8
.057
p=1-exp(-SUM/2)= .15234
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG rng.32
b-rank test for bits 7 to 14
OBSERVED
EXPECTED
(O-E)^2/E
r<=4
924
944.3
.436
r =5
21709
21743.9
.056
r =6
77367
77311.8
.039
p=1-exp(-SUM/2)= .23351
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG rng.32
b-rank test for bits 8 to 15
OBSERVED
EXPECTED
(O-E)^2/E
r<=4
1006
944.3
4.031
r =5
21784
21743.9
.074
r =6
77210
77311.8
.134
p=1-exp(-SUM/2)= .87993
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG rng.32
b-rank test for bits 9 to 16
OBSERVED
EXPECTED
(O-E)^2/E
r<=4
967
944.3
.546
r =5
22053
21743.9
4.394
r =6
76980
77311.8
1.424
p=1-exp(-SUM/2)= .95849
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG rng.32
b-rank test for bits 10 to 17
OBSERVED
EXPECTED
(O-E)^2/E
r<=4
965
944.3
.454
r =5
21778
21743.9
.053
r =6
77257
77311.8
.039
p=1-exp(-SUM/2)= .23892
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG rng.32
b-rank test for bits 11 to 18
OBSERVED
EXPECTED
(O-E)^2/E
r<=4
957
944.3
.171
r =5
21925
21743.9
1.508
r =6
77118
77311.8
.486
p=1-exp(-SUM/2)= .66124
Rank of a 6x8 binary matrix,

SUM
.002
.018
.023

SUM
.295
3.307
4.047

SUM
.145
.145
.147

SUM
.812
.822
.844

SUM
.135
.274
.331

SUM
.436
.492
.532

SUM
4.031
4.105
4.239

SUM
.546
4.940
6.364

SUM
.454
.507
.546

SUM
.171
1.679
2.165

321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400

rows formed from eight bits of the RNG rng.32


b-rank test for bits 12 to 19
OBSERVED
EXPECTED
(O-E)^2/E
r<=4
956
944.3
.145
r =5
21448
21743.9
4.027
r =6
77596
77311.8
1.045
p=1-exp(-SUM/2)= .92633
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG rng.32
b-rank test for bits 13 to 20
OBSERVED
EXPECTED
(O-E)^2/E
r<=4
934
944.3
.112
r =5
21551
21743.9
1.711
r =6
77515
77311.8
.534
p=1-exp(-SUM/2)= .69237
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG rng.32
b-rank test for bits 14 to 21
OBSERVED
EXPECTED
(O-E)^2/E
r<=4
982
944.3
1.505
r =5
21820
21743.9
.266
r =6
77198
77311.8
.168
p=1-exp(-SUM/2)= .62070
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG rng.32
b-rank test for bits 15 to 22
OBSERVED
EXPECTED
(O-E)^2/E
r<=4
1027
944.3
7.242
r =5
21556
21743.9
1.624
r =6
77417
77311.8
.143
p=1-exp(-SUM/2)= .98894
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG rng.32
b-rank test for bits 16 to 23
OBSERVED
EXPECTED
(O-E)^2/E
r<=4
993
944.3
2.511
r =5
21661
21743.9
.316
r =6
77346
77311.8
.015
p=1-exp(-SUM/2)= .75860
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG rng.32
b-rank test for bits 17 to 24
OBSERVED
EXPECTED
(O-E)^2/E
r<=4
918
944.3
.733
r =5
21752
21743.9
.003
r =6
77330
77311.8
.004
p=1-exp(-SUM/2)= .30922
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG rng.32
b-rank test for bits 18 to 25
OBSERVED
EXPECTED
(O-E)^2/E
r<=4
937
944.3
.056
r =5
21606
21743.9
.875
r =6
77457
77311.8
.273
p=1-exp(-SUM/2)= .45220
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG rng.32
b-rank test for bits 19 to 26
OBSERVED
EXPECTED
(O-E)^2/E
r<=4
899
944.3
2.173
r =5
21540
21743.9
1.912
r =6
77561
77311.8
.803
p=1-exp(-SUM/2)= .91321
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG rng.32
b-rank test for bits 20 to 27
OBSERVED
EXPECTED
(O-E)^2/E
r<=4
947
944.3
.008
r =5
21631
21743.9
.586
r =6
77422
77311.8
.157
p=1-exp(-SUM/2)= .31305
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG rng.32
b-rank test for bits 21 to 28
OBSERVED
EXPECTED
(O-E)^2/E
r<=4
887
944.3
3.477
r =5
21657
21743.9
.347
r =6
77456
77311.8
.269
p=1-exp(-SUM/2)= .87084
Rank of a 6x8 binary matrix,

SUM
.145
4.172
5.216

SUM
.112
1.824
2.358

SUM
1.505
1.771
1.939

SUM
7.242
8.866
9.009

SUM
2.511
2.828
2.843

SUM
.733
.736
.740

SUM
.056
.931
1.204

SUM
2.173
4.085
4.889

SUM
.008
.594
.751

SUM
3.477
3.824
4.093

401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480

rows formed from eight bits of the RNG rng.32


b-rank test for bits 22 to 29
OBSERVED
EXPECTED
(O-E)^2/E
SUM
r<=4
864
944.3
6.829
6.829
r =5
21849
21743.9
.508
7.337
r =6
77287
77311.8
.008
7.345
p=1-exp(-SUM/2)= .97458
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG rng.32
b-rank test for bits 23 to 30
OBSERVED
EXPECTED
(O-E)^2/E
SUM
r<=4
926
944.3
.355
.355
r =5
21751
21743.9
.002
.357
r =6
77323
77311.8
.002
.359
p=1-exp(-SUM/2)= .16416
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG rng.32
b-rank test for bits 24 to 31
OBSERVED
EXPECTED
(O-E)^2/E
SUM
r<=4
968
944.3
.595
.595
r =5
21713
21743.9
.044
.639
r =6
77319
77311.8
.001
.639
p=1-exp(-SUM/2)= .27361
Rank of a 6x8 binary matrix,
rows formed from eight bits of the RNG rng.32
b-rank test for bits 25 to 32
OBSERVED
EXPECTED
(O-E)^2/E
SUM
r<=4
938
944.3
.042
.042
r =5
21745
21743.9
.000
.042
r =6
77317
77311.8
.000
.042
p=1-exp(-SUM/2)= .02100
TEST SUMMARY, 25 tests on 100,000 random 6x8 matrices
These should be 25 uniform [0,1] random variables:
.049676
.011680
.867808
.070915
.344338
.152337
.233513
.879925
.958490
.238920
.661241
.926332
.692373
.620705
.988943
.758605
.309217
.452204
.913210
.313050
.870836
.974582
.164158
.273611
.021003
brank test summary for rng.32
The KS test for those 25 supposed UNI's yields
KS p-value= .718071
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
THE BITSTREAM TEST
::
:: The file under test is viewed as a stream of bits. Call them ::
:: b1,b2,... . Consider an alphabet with two "letters", 0 and 1 ::
:: and think of the stream of bits as a succession of 20-letter ::
:: "words", overlapping. Thus the first word is b1b2...b20, the ::
:: second is b2b3...b21, and so on. The bitstream test counts
::
:: the number of missing 20-letter (20-bit) words in a string of ::
:: 2^21 overlapping 20-letter words. There are 2^20 possible 20 ::
:: letter words. For a truly random string of 2^21+19 bits, the ::
:: number of missing words j should be (very close to) normally ::
:: distributed with mean 141,909 and sigma 428. Thus
::
:: (j-141909)/428 should be a standard normal variate (z score) ::
:: that leads to a uniform [0,1) p value. The test is repeated ::
:: twenty times.
::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
THE OVERLAPPING 20-tuples BITSTREAM TEST, 20 BITS PER WORD, N words
This test uses N=2^21 and samples the bitstream 20 times.
No. missing words should average 141909. with sigma=428.
--------------------------------------------------------tst no 1: 142350 missing words,
1.03 sigmas from mean, p-value= .84840
tst no 2: 141593 missing words,
-.74 sigmas from mean, p-value= .22993
tst no 3: 141662 missing words,
-.58 sigmas from mean, p-value= .28168
tst no 4: 141810 missing words,
-.23 sigmas from mean, p-value= .40824
tst no 5: 142055 missing words,
.34 sigmas from mean, p-value= .63321
tst no 6: 141593 missing words,
-.74 sigmas from mean, p-value= .22993
tst no 7: 142346 missing words,
1.02 sigmas from mean, p-value= .84620
tst no 8: 142596 missing words,
1.60 sigmas from mean, p-value= .94568
tst no 9: 142024 missing words,
.27 sigmas from mean, p-value= .60562
tst no 10: 141797 missing words,
-.26 sigmas from mean, p-value= .39649
tst no 11: 141182 missing words,
-1.70 sigmas from mean, p-value= .04463
tst no 12: 142100 missing words,
.45 sigmas from mean, p-value= .67202
tst no 13: 141443 missing words,
-1.09 sigmas from mean, p-value= .13796
tst no 14: 141708 missing words,
-.47 sigmas from mean, p-value= .31904
tst no 15: 142750 missing words,
1.96 sigmas from mean, p-value= .97525
tst no 16: 142080 missing words,
.40 sigmas from mean, p-value= .65497

481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560

tst
tst
tst
tst

no
no
no
no

17:
18:
19:
20:

141579
142721
143076
142746

missing
missing
missing
missing

words,
words,
words,
words,

-.77
1.90
2.73
1.95

sigmas
sigmas
sigmas
sigmas

from
from
from
from

mean,
mean,
mean,
mean,

p-value=
p-value=
p-value=
p-value=

.22012
.97105
.99679
.97470

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
The tests OPSO, OQSO and DNA
::
::
OPSO means Overlapping-Pairs-Sparse-Occupancy
::
:: The OPSO test considers 2-letter words from an alphabet of
::
:: 1024 letters. Each letter is determined by a specified ten
::
:: bits from a 32-bit integer in the sequence to be tested. OPSO ::
:: generates 2^21 (overlapping) 2-letter words (from 2^21+1
::
:: "keystrokes") and counts the number of missing words---that ::
:: is 2-letter words which do not appear in the entire sequence. ::
:: That count should be very close to normally distributed with ::
:: mean 141,909, sigma 290. Thus (missingwrds-141909)/290 should ::
:: be a standard normal variable. The OPSO test takes 32 bits at ::
:: a time from the test file and uses a designated set of ten
::
:: consecutive bits. It then restarts the file for the next de- ::
:: signated 10 bits, and so on.
::
::
::
::
OQSO means Overlapping-Quadruples-Sparse-Occupancy
::
::
The test OQSO is similar, except that it considers 4-letter ::
:: words from an alphabet of 32 letters, each letter determined ::
:: by a designated string of 5 consecutive bits from the test
::
:: file, elements of which are assumed 32-bit random integers.
::
:: The mean number of missing words in a sequence of 2^21 four- ::
:: letter words, (2^21+3 "keystrokes"), is again 141909, with
::
:: sigma = 295. The mean is based on theory; sigma comes from
::
:: extensive simulation.
::
::
::
::
The DNA test considers an alphabet of 4 letters:: C,G,A,T,::
:: determined by two designated bits in the sequence of random
::
:: integers being tested. It considers 10-letter words, so that ::
:: as in OPSO and OQSO, there are 2^20 possible words, and the
::
:: mean number of missing words from a string of 2^21 (over::
:: lapping) 10-letter words (2^21+9 "keystrokes") is 141909.
::
:: The standard deviation sigma=339 was determined as for OQSO
::
:: by simulation. (Sigma for OPSO, 290, is the true value (to
::
:: three places), not determined by simulation.
::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
OPSO test for generator rng.32
Output: No. missing words (mw), equiv normal variate (z), p-value (p)
mw
z
p
OPSO for rng.32
using bits 23 to 32
141956
.161 .5639
OPSO for rng.32
using bits 22 to 31
141956
.161 .5639
OPSO for rng.32
using bits 21 to 30
141713 -.677 .2492
OPSO for rng.32
using bits 20 to 29
142168
.892 .8138
OPSO for rng.32
using bits 19 to 28
141916
.023 .5092
OPSO for rng.32
using bits 18 to 27
141966
.195 .5775
OPSO for rng.32
using bits 17 to 26
141588 -1.108 .1339
OPSO for rng.32
using bits 16 to 25
141697 -.732 .2320
OPSO for rng.32
using bits 15 to 24
142554 2.223 .9869
OPSO for rng.32
using bits 14 to 23
141656 -.874 .1912
OPSO for rng.32
using bits 13 to 22
141977
.233 .5923
OPSO for rng.32
using bits 12 to 21
141777 -.456 .3241
OPSO for rng.32
using bits 11 to 20
142268 1.237 .8919
OPSO for rng.32
using bits 10 to 19
141950
.140 .5558
OPSO for rng.32
using bits 9 to 18
142211 1.040 .8509
OPSO for rng.32
using bits 8 to 17
141512 -1.370 .0853
OPSO for rng.32
using bits 7 to 16
141846 -.218 .4136
OPSO for rng.32
using bits 6 to 15
141788 -.418 .3378
OPSO for rng.32
using bits 5 to 14
142063
.530 .7019
OPSO for rng.32
using bits 4 to 13
142018
.375 .6461
OPSO for rng.32
using bits 3 to 12
142225 1.089 .8618
OPSO for rng.32
using bits 2 to 11
142103
.668 .7479
OPSO for rng.32
using bits 1 to 10
142608 2.409 .9920
OQSO test for generator rng.32
Output: No. missing words (mw), equiv normal variate (z), p-value (p)
mw
z
p
OQSO for rng.32
using bits 28 to 32
141940
.104 .5414
OQSO for rng.32
using bits 27 to 31
141980
.240 .5947
OQSO for rng.32
using bits 26 to 30
141985
.257 .6012
OQSO for rng.32
using bits 25 to 29
142076
.565 .7140
OQSO for rng.32
using bits 24 to 28
141671 -.808 .2096
OQSO for rng.32
using bits 23 to 27
141694 -.730 .2327
OQSO for rng.32
using bits 22 to 26
142061
.514 .6964
OQSO for rng.32
using bits 21 to 25
141655 -.862 .1943

561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640

OQSO for rng.32


using bits
OQSO for rng.32
using bits
OQSO for rng.32
using bits
OQSO for rng.32
using bits
OQSO for rng.32
using bits
OQSO for rng.32
using bits
OQSO for rng.32
using bits
OQSO for rng.32
using bits
OQSO for rng.32
using bits
OQSO for rng.32
using bits
OQSO for rng.32
using bits
OQSO for rng.32
using bits
OQSO for rng.32
using bits
OQSO for rng.32
using bits
OQSO for rng.32
using bits
OQSO for rng.32
using bits
OQSO for rng.32
using bits
OQSO for rng.32
using bits
OQSO for rng.32
using bits
OQSO for rng.32
using bits
DNA test for generator rng.32
Output: No. missing words (mw), equiv
DNA
DNA
DNA
DNA
DNA
DNA
DNA
DNA
DNA
DNA
DNA
DNA
DNA
DNA
DNA
DNA
DNA
DNA
DNA
DNA
DNA
DNA
DNA
DNA
DNA
DNA
DNA
DNA
DNA
DNA
DNA

for
for
for
for
for
for
for
for
for
for
for
for
for
for
for
for
for
for
for
for
for
for
for
for
for
for
for
for
for
for
for

rng.32
rng.32
rng.32
rng.32
rng.32
rng.32
rng.32
rng.32
rng.32
rng.32
rng.32
rng.32
rng.32
rng.32
rng.32
rng.32
rng.32
rng.32
rng.32
rng.32
rng.32
rng.32
rng.32
rng.32
rng.32
rng.32
rng.32
rng.32
rng.32
rng.32
rng.32

using
using
using
using
using
using
using
using
using
using
using
using
using
using
using
using
using
using
using
using
using
using
using
using
using
using
using
using
using
using
using

bits
bits
bits
bits
bits
bits
bits
bits
bits
bits
bits
bits
bits
bits
bits
bits
bits
bits
bits
bits
bits
bits
bits
bits
bits
bits
bits
bits
bits
bits
bits

20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1

to
to
to
to
to
to
to
to
to
to
to
to
to
to
to
to
to
to
to
to

24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5

141639
142198
141923
141954
141512
141916
141575
141765
141723
141942
142272
141921
141979
141612
141501
142096
141937
141836
141776
141744

-.916
.979
.046
.151
-1.347
.023
-1.133
-.489
-.632
.111
1.229
.040
.236
-1.008
-1.384
.633
.094
-.249
-.452
-.560

.1797
.8361
.5185
.5602
.0890
.5090
.1285
.3123
.2638
.5441
.8905
.5158
.5934
.1568
.0832
.7366
.5374
.4018
.3256
.2876

normal variate (z), p-value (p)


mw
z
p
31 to 32
142174
.781 .7825
30 to 31
142036
.374 .6457
29 to 30
141849 -.178 .4294
28 to 29
142096
.551 .7091
27 to 28
141687 -.656 .2560
26 to 27
141739 -.502 .3077
25 to 26
142224
.928 .8234
24 to 25
141591 -.939 .1739
23 to 24
141938
.085 .5337
22 to 23
141840 -.205 .4190
21 to 22
142172
.775 .7808
20 to 21
141957
.141 .5559
19 to 20
141867 -.125 .4503
18 to 19
142243
.984 .8375
17 to 18
141535 -1.104 .1348
16 to 17
141697 -.626 .2655
15 to 16
142189
.825 .7953
14 to 15
142255 1.020 .8461
13 to 14
142244
.987 .8382
12 to 13
141922
.037 .5149
11 to 12
141824 -.252 .4006
10 to 11
142189
.825 .7953
9 to 10
141467 -1.305 .0960
8 to 9
142200
.857 .8044
7 to 8
142071
.477 .6833
6 to 7
142176
.787 .7843
5 to 6
141753 -.461 .3223
4 to 5
142163
.748 .7729
3 to 4
142368 1.353 .9120
2 to 3
142294 1.135 .8718
1 to 2
142688 2.297 .9892

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
This is the COUNT-THE-1's TEST on a stream of bytes.
::
:: Consider the file under test as a stream of bytes (four per
::
:: 32 bit integer). Each byte can contain from 0 to 8 1's,
::
:: with probabilities 1,8,28,56,70,56,28,8,1 over 256. Now let ::
:: the stream of bytes provide a string of overlapping 5-letter ::
:: words, each "letter" taking values A,B,C,D,E. The letters are ::
:: determined by the number of 1's in a byte:: 0,1,or 2 yield A,::
:: 3 yields B, 4 yields C, 5 yields D and 6,7 or 8 yield E. Thus ::
:: we have a monkey at a typewriter hitting five keys with vari- ::
:: ous probabilities (37,56,70,56,37 over 256). There are 5^5
::
:: possible 5-letter words, and from a string of 256,000 (over- ::
:: lapping) 5-letter words, counts are made on the frequencies
::
:: for each word.
The quadratic form in the weak inverse of
::
:: the covariance matrix of the cell counts provides a chisquare ::
:: test:: Q5-Q4, the difference of the naive Pearson sums of
::
:: (OBS-EXP)^2/EXP on counts for 5- and 4-letter cell counts.
::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Test results for rng.32
Chi-square with 5^5-5^4=2500 d.of f. for sample size:2560000
chisquare equiv normal p-value
Results fo COUNT-THE-1's in successive bytes:
byte stream for rng.32
2581.57
1.154
.875652

641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720

byte stream for rng.32

2511.90

.168

.566796

$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
This is the COUNT-THE-1's TEST for specific bytes.
::
:: Consider the file under test as a stream of 32-bit integers. ::
:: From each integer, a specific byte is chosen , say the left- ::
:: most:: bits 1 to 8. Each byte can contain from 0 to 8 1's,
::
:: with probabilitie 1,8,28,56,70,56,28,8,1 over 256. Now let
::
:: the specified bytes from successive integers provide a string ::
:: of (overlapping) 5-letter words, each "letter" taking values ::
:: A,B,C,D,E. The letters are determined by the number of 1's, ::
:: in that byte:: 0,1,or 2 ---> A, 3 ---> B, 4 ---> C, 5 ---> D,::
:: and 6,7 or 8 ---> E. Thus we have a monkey at a typewriter ::
:: hitting five keys with with various probabilities:: 37,56,70,::
:: 56,37 over 256. There are 5^5 possible 5-letter words, and
::
:: from a string of 256,000 (overlapping) 5-letter words, counts ::
:: are made on the frequencies for each word. The quadratic form ::
:: in the weak inverse of the covariance matrix of the cell
::
:: counts provides a chisquare test:: Q5-Q4, the difference of ::
:: the naive Pearson sums of (OBS-EXP)^2/EXP on counts for 5::
:: and 4-letter cell counts.
::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Chi-square with 5^5-5^4=2500 d.of f. for sample size: 256000
chisquare equiv normal p value
Results for COUNT-THE-1's in specified bytes:
bits 1 to 8 2543.54
.616
.730962
bits 2 to 9 2394.74
-1.489
.068299
bits 3 to 10 2572.75
1.029
.848216
bits 4 to 11 2514.84
.210
.583130
bits 5 to 12 2589.96
1.272
.898360
bits 6 to 13 2355.54
-2.043
.020531
bits 7 to 14 2441.75
-.824
.205014
bits 8 to 15 2535.97
.509
.694511
bits 9 to 16 2551.09
.723
.765020
bits 10 to 17 2363.09
-1.936
.026421
bits 11 to 18 2518.86
.267
.605181
bits 12 to 19 2485.76
-.201
.420217
bits 13 to 20 2515.30
.216
.585646
bits 14 to 21 2407.06
-1.314
.094358
bits 15 to 22 2426.05
-1.046
.147831
bits 16 to 23 2563.57
.899
.815683
bits 17 to 24 2475.94
-.340
.366804
bits 18 to 25 2466.11
-.479
.315864
bits 19 to 26 2514.20
.201
.579603
bits 20 to 27 2452.66
-.669
.251594
bits 21 to 28 2634.28
1.899
.971222
bits 22 to 29 2430.47
-.983
.162740
bits 23 to 30 2532.62
.461
.677734
bits 24 to 31 2525.65
.363
.641629
bits 25 to 32 2541.32
.584
.720496
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
THIS IS A PARKING LOT TEST
::
:: In a square of side 100, randomly "park" a car---a circle of ::
:: radius 1.
Then try to park a 2nd, a 3rd, and so on, each
::
:: time parking "by ear". That is, if an attempt to park a car ::
:: causes a crash with one already parked, try again at a new
::
:: random location. (To avoid path problems, consider parking
::
:: helicopters rather than cars.)
Each attempt leads to either ::
:: a crash or a success, the latter followed by an increment to ::
:: the list of cars already parked. If we plot n: the number of ::
:: attempts, versus k:: the number successfully parked, we get a::
:: curve that should be similar to those provided by a perfect
::
:: random number generator. Theory for the behavior of such a
::
:: random curve seems beyond reach, and as graphics displays are ::
:: not available for this battery of tests, a simple characteriz ::
:: ation of the random experiment is used: k, the number of cars ::
:: successfully parked after n=12,000 attempts. Simulation shows ::
:: that k should average 3523 with sigma 21.9 and is very close ::
:: to normally distributed. Thus (k-3523)/21.9 should be a st- ::
:: andard normal variable, which, converted to a uniform varia- ::
:: ble, provides input to a KSTEST based on a sample of 10.
::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
CDPARK: result of ten tests on file rng.32
Of 12,000 tries, the average no. of successes
should be 3523 with sigma=21.9

721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800

Successes:
Successes:
Successes:
Successes:
Successes:
Successes:
Successes:
Successes:
Successes:
Successes:

3534
3480
3518
3500
3540
3491
3511
3510
3506
3540

z-score:
.502 p-value: .692266
z-score: -1.963 p-value: .024796
z-score: -.228 p-value: .409702
z-score: -1.050 p-value: .146807
z-score:
.776 p-value: .781201
z-score: -1.461 p-value: .071982
z-score: -.548 p-value: .291865
z-score: -.594 p-value: .276387
z-score: -.776 p-value: .218799
z-score:
.776 p-value: .781201

square size
avg. no. parked
sample sigma
100.
3513.000
19.282
KSTEST for the above 10: p= .754720
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
THE MINIMUM DISTANCE TEST
::
:: It does this 100 times::
choose n=8000 random points in a
::
:: square of side 10000. Find d, the minimum distance between
::
:: the (n^2-n)/2 pairs of points. If the points are truly inde- ::
:: pendent uniform, then d^2, the square of the minimum distance ::
:: should be (very close to) exponentially distributed with mean ::
:: .995 . Thus 1-exp(-d^2/.995) should be uniform on [0,1) and ::
:: a KSTEST on the resulting 100 values serves as a test of uni- ::
:: formity for random points in the square. Test numbers=0 mod 5 ::
:: are printed but the KSTEST is based on the full set of 100
::
:: random choices of 8000 points in the 10000x10000 square.
::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
This is the MINIMUM DISTANCE test
for random integers in the file rng.32
Sample no.
d^2
avg
equiv uni
5
2.6399
1.0322
.929574
10
.1894
.7103
.173313
15
.2167
.8168
.195670
20
1.7202
.9084
.822515
25
.0505
.9032
.049472
30
.2419
.8864
.215781
35
.3905
.9212
.324624
40
3.4553
1.0062
.968967
45
.7277
.9756
.518728
50
.2264
1.0284
.203511
55
.0644
.9692
.062681
60
.3547
.9718
.299896
65
.3474
.9820
.294743
70
1.0588
1.0201
.654973
75
1.9523
1.0284
.859438
80
1.0461
1.0149
.650554
85
.5992
.9822
.452410
90
.3606
.9955
.303979
95
.1349
.9865
.126824
100
.7045
.9646
.507400
MINIMUM DISTANCE TEST for rng.32
Result of KS test on 20 transformed mindist^2's:
p-value= .066791
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
THE 3DSPHERES TEST
::
:: Choose 4000 random points in a cube of edge 1000. At each
::
:: point, center a sphere large enough to reach the next closest ::
:: point. Then the volume of the smallest such sphere is (very
::
:: close to) exponentially distributed with mean 120pi/3. Thus ::
:: the radius cubed is exponential with mean 30. (The mean is
::
:: obtained by extensive simulation). The 3DSPHERES test gener- ::
:: ates 4000 such spheres 20 times. Each min radius cubed leads ::
:: to a uniform variable by means of 1-exp(-r^3/30.), then a
::
:: KSTEST is done on the 20 p-values.
::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
The 3DSPHERES test for file rng.32
sample no: 1
r^3=
2.456
p-value= .07862
sample no: 2
r^3= 33.632
p-value= .67407
sample no: 3
r^3= 17.147
p-value= .43536
sample no: 4
r^3=
6.693
p-value= .19995
sample no: 5
r^3= 34.353
p-value= .68181
sample no: 6
r^3= 131.636
p-value= .98757
sample no: 7
r^3=
5.527
p-value= .16826
sample no: 8
r^3= 30.472
p-value= .63786

801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880

sample no: 9
r^3=
1.365
p-value= .04448
sample no: 10
r^3= 38.735
p-value= .72505
sample no: 11
r^3= 48.804
p-value= .80344
sample no: 12
r^3= 47.645
p-value= .79570
sample no: 13
r^3= 219.292
p-value= .99933
sample no: 14
r^3=
9.078
p-value= .26110
sample no: 15
r^3=
.896
p-value= .02941
sample no: 16
r^3= 32.395
p-value= .66035
sample no: 17
r^3=
4.243
p-value= .13190
sample no: 18
r^3= 43.663
p-value= .76670
sample no: 19
r^3=
9.466
p-value= .27060
sample no: 20
r^3= 101.247
p-value= .96578
A KS test is applied to those 20 p-values.
--------------------------------------------------------3DSPHERES test for file rng.32
p-value= .606348
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
This is the SQEEZE test
::
:: Random integers are floated to get uniforms on [0,1). Start- ::
:: ing with k=2^31=2147483647, the test finds j, the number of ::
:: iterations necessary to reduce k to 1, using the reduction
::
:: k=ceiling(k*U), with U provided by floating integers from
::
:: the file being tested. Such j's are found 100,000 times,
::
:: then counts for the number of times j was <=6,7,...,47,>=48 ::
:: are used to provide a chi-square test for cell frequencies. ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
RESULTS OF SQUEEZE TEST FOR rng.32
Table of standardized frequency counts
( (obs-exp)/sqrt(exp) )^2
for j taking values <=6,7,8,...,47,>=48:
-.8
.5
-.1
.6
-.4
2.4
-.6
3.2
2.3
2.9
2.9
4.6
3.7
1.7
2.0
1.2
.9
.9
.4
-2.1
-2.6
-3.1
-1.6
-3.1
-1.8
-3.5
-3.5
-2.0
-3.8
-1.2
-2.5
-2.2
-2.9
-2.3
-2.3
-1.4
-.7
-.7
.9
-.7
-.6
.0
-1.1
Chi-square with 42 degrees of freedom:199.921
z-score= 17.231 p-value=1.000000
______________________________________________________________
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
The OVERLAPPING SUMS test
::
:: Integers are floated to get a sequence U(1),U(2),... of uni- ::
:: form [0,1) variables. Then overlapping sums,
::
::
S(1)=U(1)+...+U(100), S2=U(2)+...+U(101),... are formed.
::
:: The S's are virtually normal with a certain covariance mat::
:: rix. A linear transformation of the S's converts them to a
::
:: sequence of independent standard normals, which are converted ::
:: to uniform variables for a KSTEST. The p-values from ten
::
:: KSTESTs are given still another KSTEST.
::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Test no. 1
p-value .479286
Test no. 2
p-value .511698
Test no. 3
p-value .369057
Test no. 4
p-value .756690
Test no. 5
p-value .879096
Test no. 6
p-value .716027
Test no. 7
p-value .790289
Test no. 8
p-value .173278
Test no. 9
p-value .186146
Test no. 10
p-value .896488
Results of the OSUM test for rng.32
KSTEST on the above 10 p-values: .360394
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
This is the RUNS test. It counts runs up, and runs down, ::
:: in a sequence of uniform [0,1) variables, obtained by float- ::
:: ing the 32-bit integers in the specified file. This example
::
:: shows how runs are counted: .123,.357,.789,.425,.224,.416,.95::
:: contains an up-run of length 3, a down-run of length 2 and an ::
:: up-run of (at least) 2, depending on the next values. The
::
:: covariance matrices for the runs-up and runs-down are well
::
:: known, leading to chisquare tests for quadratic forms in the ::

881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944

:: weak inverses of the covariance matrices. Runs are counted


::
:: for sequences of length 10,000. This is done ten times. Then ::
:: repeated.
::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
The RUNS test for file rng.32
Up and down runs in a sample of 10000
_________________________________________________
Run test for rng.32
:
runs up; ks test for 10 p's: .967233
runs down; ks test for 10 p's: .098223
Run test for rng.32
:
runs up; ks test for 10 p's: .114775
runs down; ks test for 10 p's: .180498
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: This is the CRAPS TEST. It plays 200,000 games of craps, finds::
:: the number of wins and the number of throws necessary to end ::
:: each game. The number of wins should be (very close to) a
::
:: normal with mean 200000p and variance 200000p(1-p), with
::
:: p=244/495. Throws necessary to complete the game can vary
::
:: from 1 to infinity, but counts for all>21 are lumped with 21. ::
:: A chi-square test is made on the no.-of-throws cell counts.
::
:: Each 32-bit integer from the test file provides the value for ::
:: the throw of a die, by floating to [0,1), multiplying by 6
::
:: and taking 1 plus the integer part of the result.
::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Results of craps test for rng.32
No. of wins: Observed Expected
98760
98585.86
98760= No. of wins, z-score= .779 pvalue= .78197
Analysis of Throws-per-Game:
Chisq= 25.29 for 20 degrees of freedom, p= .80937
Throws Observed Expected Chisq
Sum
1
66745
66666.7
.092
.092
2
37536
37654.3
.372
.464
3
27038
26954.7
.257
.721
4
19173
19313.5
1.022
1.743
5
13694
13851.4
1.789
3.532
6
9958
9943.5
.021
3.553
7
7285
7145.0
2.742
6.295
8
4978
5139.1
5.048
11.343
9
3802
3699.9
2.819
14.163
10
2744
2666.3
2.264
16.427
11
1968
1923.3
1.038
17.465
12
1383
1388.7
.024
17.488
13
994
1003.7
.094
17.582
14
708
726.1
.453
18.036
15
562
525.8
2.487
20.523
16
372
381.2
.220
20.743
17
294
276.5
1.102
21.845
18
227
200.8
3.410
25.255
19
145
146.0
.007
25.262
20
105
106.2
.014
25.276
21
289
287.1
.012
25.288
SUMMARY FOR rng.32
p-value for no. of wins: .781968
p-value for throws/game: .809371
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
Results of DIEHARD battery of tests sent to file rng.out

Vous aimerez peut-être aussi