Procedure GetRandom(nEnd:Integer);
var
nTmp,nTmp2:Integer; LstTmp:TStringList;
begin
LstTmp:=TStringList.Create;
for nTmp:=0 to nEnd-1 do LstTmp.Add(IntToStr(nTmp));
for nTmp:=nEnd-1 Downto 0 do
begin
Randomize; nTmp2:=Random(nTmp+1);
ShowMessage(LstTmp[nTmp2]);//显示获取的随机数
LstTmp.Delete(nTmp2);
end;
LstTmp.Free;
end;
var
nTmp,nTmp2:Integer; LstTmp:TStringList;
begin
LstTmp:=TStringList.Create;
for nTmp:=0 to nEnd-1 do LstTmp.Add(IntToStr(nTmp));
for nTmp:=nEnd-1 Downto 0 do
begin
Randomize; nTmp2:=Random(nTmp+1);
ShowMessage(LstTmp[nTmp2]);//显示获取的随机数
LstTmp.Delete(nTmp2);
end;
LstTmp.Free;
end;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货