T=1:For X=1 To 5:For Y=1 To 5:ST(T)=MilliSecs():TI(T)=Rand(18000,50000):T=T+1:Next:Next:T=1While Not KeyDown(1).ag For X=1 To 5:For Y=1 To 5If MilliSecs()-ST(T)>=TI(T) NC(T)=Rand(0,2):FD(T)=(NC(T)>0):ST(T)=MilliSecs():TI(T)=Rand(18000,50000):;Goto agEndIfIf NC(T)=0 Then Color 0,0,0:Rect XX+(X-1)*(SQD+SSP),YY+(Y-1)*(SQD+SSP),SQD,SQD,1Color 255*(NC(T)=0)+250*(NC(T)=1)+20*(NC(T)=2),255*(NC(T)=0)+20*(NC(T)=1)+250*(NC(T)=2),255*(NC(T)=0)Rect XX+(X-1)*(SQD+SSP),YY+(Y-1)*(SQD+SSP),SQD,SQD,FD(T)T=T+1:If T>25 Then T=1Next:Next;VWaitWend

Look at this code

the interval is not happening according to the programmed code.

Const XX=5 ; X_OFFSETConst YY=5 ; Y_OFFSETConst SQD=50 ; TILE_SIZEConst SSP=2 ; TILE_SPACING; use consts instead of magic numbers to keep your code flexibleConst FIELD_WIDTH% = 5Const FIELD_HEIGHT% = 5Const FIELD_SIZE% = FIELD_WIDTH * FIELD_HEIGHTDim ST(FIELD_SIZE)Dim TI(FIELD_SIZE)Dim NC(FIELD_SIZE)Dim FD(FIELD_SIZE)Local T=1Local X%, Y%Graphics(400,300,0,2)SetBuffer BackBuffer(); init tiles; "pro" tip: swap the X and Y for loops (to X being the inner one), so the; tiles are arranged in reading direction - which can come in handy in; many places, especially when debugging.For X=1 To FIELD_WIDTH For Y=1 To FIELD_HEIGHT ; instead of using "now" & "interval" you could directly add them ; and only store "next change time", e.g: ; tchange(T) = MilliSec() + Rand(18000,50000) ST(T)=MilliSecs() ; set that tile's starting time to "now" TI(T)=Rand(18000,50000) ; set that tile's interval T=T+1 NextNextWhile Not KeyDown(1) ; update and draw tiles T=1 For X=1 To FIELD_WIDTH For Y=1 To FIELD_HEIGHT ; check if tile's interval has passed If MilliSecs()-ST(T)>=TI(T) Then ;... and update tile definitions NC(T)=Rand(0,2) FD(T)=(NC(T)>0) ;... and set new interval ST(T)=MilliSecs() TI(T)=Rand(18000,50000) EndIf ; black tile background If NC(T)=0 Then Color 0,0,0 Rect XX+(X-1)*(SQD+SSP),YY+(Y-1)*(SQD+SSP),SQD,SQD,1 EndIf ; a select NC(T) statement wouldn't hurt here Color 255*(NC(T)=0)+250*(NC(T)=1)+20*(NC(T)=2),255*(NC(T)=0)+20*(NC(T)=1)+250*(NC(T)=2),255*(NC(T)=0) ; draw coloured tile foreground Rect XX+(X-1)*(SQD+SSP),YY+(Y-1)*(SQD+SSP),SQD,SQD,FD(T) T=T+1 Next Next Flip(0)Wend