- 人气:
- 放大
- 缩小
- 二维码
- 赞赏
delphi 生成不重复数字随机码
function GeneraNIP(Longitud: Integer): String;
var
s : String;
i : Integer;
begin
Randomize;
s:='';
for i:=1 to 255 do
s:=s + IntToStr(Random(10) + 1);
i:=Random(253 - Longitud) + 1;
Result:=Copy(S, i, Longitud);
if Result[1] = '0' then
Result[1]:='1';
end;
procedure TForm2.Button1Click(Sender: TObject);
begin
form2.Caption:=GeneraNIP(10);
end;