我来写一个,不知管不管用
const xl=5;
yl=15;
type storp=record
x,y:integer;
end;
var stp:array [1..6,1..6] of storp;/*存放生成的36个点
point:arraty [1..xl,1..yl] of boolean;/*判断该坐标是否已被取得
row:array [1..yl] of boolean;/*判断该行是否已被取过
procedure getpoint(var st:storp;y:integer);
var i,j,m,n:integer;
t:boolean;
begin
rondomize;
for j:=1 to 6do
begin
t:=false;
repeat
n:=rondom(yl)+1;
for i:=1 to yldo
if row[n] then
t:=true;
until (not t);
m:=rondom(xl)+1;
while point[m,n]do
m:=(m+1) mod xl;
/*如生成的点已被取过,直接取下一个点*/
st[y,j].x:=m;
st[y,j].y:=n;
point[m,n]:=true;
end;
end;
procedure main;
var i,j:integer;
begin
for i:=1 to xldo
for j:=1 to yldo
point[i,j]:=false;
for i:=1 to 6do
begin
for j:=1 to yldo
row[j]:=false;
getpoint(stp,i);
end;
end;