for to do begin random random TBitbtn FindComponent BitBtn IntToStr To

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
for i:=1 to 9 do begin
a:=random(9)+1;
b:=random(9)+1;
c:=y[a];
y[a]:=y[b];
y[b]:=c;
TBitbtn(FindComponent('BitBtn' + IntToStr (i))).Top:=c;
TBitbtn(FindComponent('BitBtn' + IntToStr (i))).left:=x[a];
end;