bAllNotZero:=true;
Randomize;
for i:=0 to iMaxRow do
for j:=0 to iMaxCol do
begin
if aryTemp[i,j]=0 then
begin
bAllNotZero:=false;
aryTemp[i,j]:=Random;
end;
end
if bAllNotZero=true then
/////全不为0
Randomize;
for i:=0 to iMaxRow do
for j:=0 to iMaxCol do
begin
if aryTemp[i,j]=0 then
begin
bAllNotZero:=false;
aryTemp[i,j]:=Random;
end;
end
if bAllNotZero=true then
/////全不为0
iNotZeroCnt:=0;
for i:=0 to iMaxRow do
for j:=0 to iMaxCol do
if aryTemp[i,j]=0 then
inc(iNotZeroCnt);Randomize;
iIndex:=0;
if iNotZeroCnt>0 then
begin
iPos:=Random(iNotZeroCnt);
for i:=0 to iMaxRow do
for j:=0 to iMaxCol do
begin
if aryTemp[i,j]=0 then
begin
inc(iIndex);
if iIndex=iPos then
//////////随机找到一个数据,i,j为横、纵坐标。
end;
end
end else
/////全不为0