Classic Computer Magazine Archive COMPUTE! ISSUE 48 / MAY 1984 / PAGE 10

TI Randomness Test

Richard Mansfield's article "Zones Of Unpredictability, Part 2" ("The Beginner's Page," COMPUTE!, December 1983) included a program called "Randomness Test." Since it wouldn't work on my TI-99/4A, I wrote a similar program. It takes several thousand cycles to get close to even distribution for each number, but it's fun to let it run.

Gaston Porterie

100 CALL CLEAR
110 PRINT "TEST OF THE RANDOM NUMBER", "FUNCTION ON THE TI-99" ;;;;;;;;
120 PRINT "PLEASE WAIT..."
130 T = T + 1
140 RANDOMIZE
150 X = INT (10*RND) + 1
160 A(X) = A(X) + 1
170 FOR I = 1 TO 10
180 P(I) = INT (A(I) / T*100)
190 NEXT I
200 IF T/100<>INT(T/100) THEN 130
210 CALL CLEAR
220 PRINT "AFTER";T; "CYCLES"; "OF RANDOMIZATION"
230 PRINT
240 PRINT "RANDOM", "%", "NUMBERS", "OCCURRENCE"
250 S = 0
260 FOR I = 1 TO 10
270 PRINT I, P(I)
280 S = S + P (I)
290 NEXT I
300 PRINT "","-----"
310 PRINT "TOTAL", S; "%"
320 GOTO 130