2262-121-T UNIVERSITY OF MICHIGAN ENGINEERING RESEARCH INSTITUTE ELECTRONIC DEFENSE GROUP TECHNICAL MEMORANDUM NO.'29 BY~ R. R. McPherson DATE: July 10, 1956 SUBJECT: Use of Hewlett-Packard Model 522B Electronic Counter as a "Spinning Disc" Random Number Selector ABSTRACT Manual methods are described for selecting uniformly distributed random numbers by means of an electronic counter. Their randomness is illustrated by a trial result. A method fdr converting uniformly distributed random numbers to arbitrariy distributed random numbers is illustrated. I. INTRODUCTION The "spinning disc" random number selector* is a device for choosing decimal digits at random. The name derives from a construction utilizing a flash lamp to stop the motion of a number-carrying disc so that an operator can read the digit exposed through a window in a coverf, behind which the disc is rotated by a fast motor. Other forms of spinning-dipc random number selector may be more convenient. In particular, an indication of the selected number which can be held indefinitely may be desired. Simultaneous selection of several independent digits may also be useful. These and other characteristics may be obtained through use of the Hewlett-Packard Model 522B electronic counter, in manual operation. *' See references.

-2IIo METHODS FOR OPERATION OF THE COUNTER Two methods may be used for manual selection of random numbers which are uniformly distributed over the set of four-digit decimal numbers. The first method uses only the counter and the manual gate function. The second method uses the counter and an adapter-box for external operation of the start-stop trigger circuits of the time interval function. Basically, the counter circuits are manually started in counting the interval 100 kc/s standard frequency. In this condition "the disc is spinning". Then the counter is manually stopped and the count read. The right-hand four digits constitute a selection from a distribution uniform in density over the 10,000 numbers 0000 to 9999 inclusive. A. The adjustments for the HP-522B using the first method are: (1) Function selector: Manual gate (2) Time unit switch: 100 kc/s standard frequency counted (3) Display time~ CCW (Minimum)e With the Manual Gate Switch in the OPEN position, the count is revolving. When the Manual Gate Switch is operated to the closed position, the count may be read. Only the right-hand four digits may be recorded as a random number. B o The adjustments for the HP-522 B using the second method areo (1) Trigger level: Start: + 20 v Stop: + 20 v (2) Trigger slope: Start: - Stop': + (3) Trigger input switch: tOmmon (4) Time unit switch: 100 kc/s standard frequency counted (5) Function selector: Time interval (6) Display time~ CCW g(minimum) ($) Phototube voltage: connected to input connector of adapter switch-box

-3(8) Trigger input (start or stop): Connected to output connector of adapter switch-box. With the switch on the Adapter Switch-Box operated to either side and returned to center position, the count is revolving. When the switch on the Adapter Switch-Box is subsequently operated to either side position, the count is displayed. Only the right-hand four digits may be recorded as a random number. IIIo CONSTRUCTION OF THE ADAPTER SWITCH-BOX An adapter switch-box, which permits remote operation of the selection of a random number., can incorporate a lever-type switch specifically designed for large numbers of repeated throws, thus saving the MaInual Gate toggle switch for its intended function of occasional use. Such an adapter which forms a manual trigger voltage from the phototube voltage is diagrammed in Figures 1, 2, and 3. A 0.5 Xf 200 v metallized paper capacitor is employed to eliminate the effects of contact bounce in the switch, even when it is abruptly operatedo In addition, the polarity of start-stop functions is arranged to employ the smooth contact closure available when operating the lever switch from Its center position to the side position for stopping the count. Because of the automatic reset function of the interval measuring circuits in the counter, unilateral action in the stopping of the count is essential for the count to be recorded as a random number. This fact requires a trigger pulse free of the effects to contact bounce at the time of stopping of the count. Otherwise, a small count due to the length of a bounce will be the count which is registered.

-4IV. RANIDOMESS OF THE NUMBERS SELECTED The numbers selected in either of the two manual methods described in Section II are random in the usual sense simply as a result of indefiniteness in human timing with respect to intervals of length 0.01 seco It is assumed that the operator fis not permitted to time his actuation of the swistch lever from the fifth counter register whose digits appear at a rate of 10 per second. This result may be accomplished either through covering the fifth register or simply ignoring the counter in operation. Figure 4 shows the results obtained in one sequence of 250 four-dlgit numbers, using the latter method and the adapter switch-box. A total of 1000 digits is recorded. The probability functions shown in Figure 4 have been defined on the set of ten digits. That is, the four digits of a single reading have been lumped onto a composite space obtained through using the fact that the method of selection makes the four digits statistically independent of one another. This procedure is simply a second interpretation of the meaning of a uniform distribution over the 10,000 four-d.git numbers. For example, by a similar extension, a' binary distribution over the digits 0, 1 can be obtained by recording a digit as 0 if it is even, as 1 if it is odd. Table 1 sumnarizes a comparison of the trial distribution function of Figure 4 with the theoretical uniform distribution in respect to a few parameters. The point of view is that no physical process of uniform distribution exists; it is only that the probability model for comparison is that of the uniform distribution. Satisfactory agreement is evident in Table lo

i x. fo Fig~ 4 Trial Distribution Uniform Distribution 10 1 0 83 n = Z fi = 100 Each fi = 100 i=1 Ri 1 94 3 2 87 Median = 5 Any x, where 4<x 5 4 3 105 Mode = 5 Undefined 10 5 4 98 Mean =/n 1 Z xifi 6 5 118 = 4.683 4.500 10 7 6 108 Second Moment = 1/n Z xi2f. i=1 8 7 101 = 29.881 28.50 9 8 91 Mean-squared = 21-930489 20.25 10 9 115 Variance = 7.950511 8.25 1000 Std. Devo = 2.8197 2.8723 TABLE 1 Comparison of Parameters of a Trial Distribution and a Theoretical Distribution Function

UG -290/U ~~~~~INPUT,~, It~SW ITCHCRAFT 3037L OUTPUT OUiP - 0.5.,Lf 200 V FIGURE I ADAPTER SWITCH -BOX 60V......58V MMAX. 0 40 V — Il 20V'' i 20VL |D~ MANU ALLY r,, o " = DETERMINED INTERVAL STOP S TART FIGURE 2 MANUAL TRIGGER FORMED BY ADAPTER SW IT CH- BOX 53 K 82 V O.5/f 125K TRIGGER VOLTAGE FIGURE 3 EQUIVALENT CIRCUIT OF ADAPTER SWITCH-BOX, PHTOOTUBE VOLTAGE SOURCE AND TRIGGER INPUT LOAD,6.

NUMBER OF OCCURRENCES, EACH DIGIT DISTRIBUTION FUNCTION OF NUMBER OF OCCURRENCES o0 0 0 0 0 0 0 0 0 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 0 0 0 0 0 0 C i~ ~ i iR i~ 0n -~~ ~ ~~~ ~~~~~~~' " —'?- - - l ---- I ~ ~ ~ ~ z m -I I~~~~~~~~~~~~~... Ti~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~,:::m:m ImmI _ 0 o~~~~~~~~ m -~~~~~~i -i'iiiii 0 ~mmI4m o m I ~~ ________ m m ~ ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~,, ____ ______ ______ I ______ ____ ___ J ______ _____________ 1 _____.1 ______~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

A x2 test of the fi, i=l, 2,.... 10, of Table 1 may be made against this uniform distribution, with each Pi = 0.10 and n = 1000. Then1 (1) x2 r (fi)npi)2 10 (fi-100)2 (1)== E 2 = 12.18, i=l npi i=1 100 (2) E( X2) = r-l = 9, 2 ~ r (3) D2( X = 2(r-1) +! r 1 2 n il= Pi - r - 2r + 2 1 10 2(9) + 10 1 - 100 - 20+2 1000 i=l 18 - 17.982, and 1000 - (4) D( X2) (X).982 = 42405 The observed X2 12.18 for the fi of Table 1 is within plus one standard deviation of the mean value 9, since 9 < 12o18 < 13..2405o Reference to a table of the theoretical limiting' \2 distribution, with 9 degrees of freedom, gives a theoretical x2 value of 16.919 at the 5% level of significance, 12.242 at the 20% level of significance, and 10.656 at the 30% level of significance. Thus the observer X2 = 12.18 would on the average be exceeded in only about one out of five trials of the kind leading to Figure 4 and Table 1. The observed X2 is npt significant at the usual level of 5%. Perhaps the best model for comparison with the fi of Table 1 is the multinomial distribution, with each probability pj of success equal to 0.1, j = 1,2.... 9, 10, and n = 1000. Then the following expected value formulasl apply~: lo H. Cramer, Mathematical Methods of Statistics, Princeton University Press, 1951, Cf p. 417, and p a315.

(5) mj = E(xj) = np.,.... 1O (6) Xjk E [(x- P)(k-nPk)] = -npjpk, k j j,k = 1,2.... 10 = npj(l-pj), k =j Evaluating these formulas, we have (7) m. = = (1000)(0.1) = 100 j 1,2,.... 10, (8) Xjk = -npjpk = -(1000)(O.1)(0.1) = -10, jk = 1,,2...10, k and (9) \jk = npj(l-pj) = (1000)(0.1)(0.9) = 90, j = 1,2.....10 k =j. Table 1 provides a comparison of fi, i=l,..o 10, with the mean mj = 100, j = 1,!... 10, and Table 2 provides a comparison of (fi m)2, i = 1, 10. i xi fi-m (fi-m)2 1 0 -17 289 2 1 -6 36 3 2 -13 169 4 3 +5 25 5 4 -2 4 6 5 +18 324 7 6 +8 64 8 7 +1 1 9 8 -9 81 10 9 +15 225 Std. Dev. o 9 487 Variance 9~ TABIE 2. Comparison of Table 1 fi with Multinomial Variance and Standard Deviation

10with the variance Xjj = 90, j = 1,... 10, and of fi-m, i = 1,... 10, with the standard deviationVjj = 9.487, j = 17 2... 10. Table 3 displays the coproducts (fj-m)(fk-m), j,k = 1,2,... 10, k A j, each to be compared with the expected value Xjk = -10, k, j, j,k = 1,2... 10. In surmary, several simple tests based on probability models give acceptable demonstration of randomness in the data of Figure 4 taken by manual operation of the HP-522B as a random number selector. k ~j 1 2 3 4 5 6 7 8 9 10 1 __ —7i 2 +102 3 +221 +78 -- 4 -85 -30 -65 -- 5 +34 +12 +26 -10 - 6 -306 -108 -234 +90 -36 7 -136' -48 -104 +40 -16 +144 -- 8 -17 -6 -13 +5 -2 +18 +8 -- 9 +153 +54 +117 -45 +18 -162 -72 -9 10 -255 -90 -195'+75 -30 +270 +120 +15 -135 -- TABLE 3. Tabulation of Coproducts V. DERIVATION OF NUMBERS DISTRIBUTED NONUNIFORMLY From numbers distributed uniformly, one'can derive numbers distributed arbitrarily through inverse use of the desired arbitrary distribution function of Figure 4, continuous on the right, is the desired

arbitrary distribution function. Then a selection of a four-digit random number, ae described in Section II, is employed graphically as follows. Suppose 4505 were the selection. Entering at 0.4505 as ordinate, the intersection with the step-function curve continuous on the right is observed to be the digit 4. Then 4 becomes the sample of a random number distributed according to Figure 4. If the desired distribution function, (t) were the normal distribution function with mean equal to zero and variance equal to one, where (10) ~ (t) = 1 ft exp (- 2) dx 4;- - Xo12 then a table1 of the functionq (t) entered inversely at 0.4505 gives t = -0.1244, interpolated linearly between Qi (-0.13) = 0.4483 and 0 (-0.12) = 0.4522. Then t = -0.1244 becomes the corresponding sample of a random number distributed so as to be normal (0, 1)o Similarly, if Pearson's Type III function, skewness L.1, were the desired distribution, then t = -0.2939 becomes the corresponding sample number. In these last two cases, the possible distribution covers the entire range of real numbers, not merely the decimal digits. Also, full use of the referenced tables would require a six-digit uniformly distributed random number. Two selections by-eithex method of Section II would then suffice, say by joining the last three digits of the two selections. As a last example, five of these digits may be used inversely with a filve-place table of comnmon logarithms to derive random numbers x between 1 and 10 distributed with density proportional to l/x. The distribution function for this case is defined by (11) Pr (x = t) = F(t), and * The step rises are associated with the absicissae at which they assae at which they are drawn, and the curve is continuous two-dimensional excepting only for the ten points at the bottoms of the rises and right-ends of the runs. These points are deleted for unique inversion. 1. H. C. Carver Mathematical Statistical Tables, Edwards Brothers, Ann ArbQr, Michigan, 1950, tCf. p. 20, Skewness = O and p. 21 Skewness = 1.1.

(12) F(t) = 0, t ~- 1; = og10 x 1 x 10; 1, 10 l- x. VI. CONCLUSIONS Either of two manually operated methods may be employed to use the Hewlett-1Pckard 522B Electronic Counter as a "Spinning-Dicst" Random Number Selector. The methods as described may be regarded as producing numbers uniformly distributed over the set of four-digit decimal numbers. Graphed or tabular forms of arbitrary distribution functions may be used to derive random numbers distributed in aribtrary fashion from the numbers produced by manual operation of the electronic counter. REFERENCES 1. R. W. Walker, "An Electronic Random Selector," Jour. Brit. I.R.E., 14:262-268, June, 1954. 2. M. G. Kendall and B. Babington Smith,'"Second Paper on Random Sampling Numbers,"` Supp. to Jour. Roy. Stat. Soc., k.6:51-61, 1939.

DISTRIBUTION LIST 60 Copies Transportation Officer, SCEL Evans Signal Laboratory Building No. 42 Belmar, New Jersey FOR - SCEL Accountable Officer Inspect at Destination File No. 22824-PH-54-91(1701) 1 Copy H o Wo Welch, Jro Engineering Research Institute University of Michigan Ann Arbor, Michigan 1 Copy Jo A. Boyd Engineering Research Institute University of Michigan Ann Arbor, Michigan 17 Copies Electronic Defense Group Project File University of Michigan Ann Arbor, Michigan 1 Copy Engineering Research Institute Project File University of Michigan Ann Arbor, Michigan 1 Copy Document Room Willow Run Laboratories University of Michigan Ypsilanti, Michigan