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;

相关阅读 >>

android实例-拍摄和分享照片、分享文本(xe8+小米2)

Delphi 如何在窗体标题栏添加按钮

Delphi 限制edit输入 多个例子

Delphi 关闭sql server 数据库所有使用连接

Delphi中的strpas功能

Delphi exe文件自效验

Delphi 利用sendinput模拟鼠标键盘

Delphi-idhttp-json用法

Delphi中format与formatdatetime函数详解

Delphi 两种登录界面验证写法

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



打赏

取消

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

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

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

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

评论

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