More Games With Random Numbers

See all articles from CATS v3 n2
Author(s): R.A. Schrack
Publication: CATS Newsletter
Pub Details: CATS v3 n2 (Volume 3, Issue 2)
Date: May 1985
Pages: 12

Another pattern to look for in r random numbers is the relation between adjacent random numbers. There should be no correlation. The plot below shows a plot of this type.

Plot of adjacent random numbers
Plot of adjacent random numbers
   5 PLOT 0,0
10 LET xl=0
20 LET yl=0
30 FOR x=1 TO 255
40 LET y=RND*158
50 LET yd=y-yl
60 LET xd=x-xl
70 DRAW xd,yd
80 LET xl=x
90 LET yl=y
100 NEXT x

Making the amplitude smaller keeps it all on the paper and you can see if there is any long term drift.

Smaller-amplitude plot showing long term drift
Smaller-amplitude plot showing long term drift
   5 PLOT 0,80
10 LET xl=0
20 LET yl=0
30 FOR i=1 TO 1000
35 LET x=INT (i/4)
36 PRINT AT 1,1;x
40 LET y=RND*15
50 LET yd=y-yl
60 LET xd=x-xl
70 DRAW xd,yd
80 LET xl=x
90 LET yl=y
100 NEXT i

R.A. Schrack

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.