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;

相关阅读 >>

delhi 获取进程图片

Delphi 正确得到本地ip

Delphi tgifimage:timage显示gif动画

Delphi 文件查找记录类型 - tsearchrec

Delphi 采用 tidhttp 访问 https 的网站,采用 tidtcpclient 访问 https 的网站

Delphi 抓屏技巧二三例

Delphi tfont类型和json互相转换的函数

Delphi 获得网页乱码

Delphi 2009 之 tcategorypanelgroup[5]: headerstyle

Delphi 无法打不开读取文件名有逗号的文件

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...