program Project2;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils,
Winapi.Windows;
function GetRandomid(vlen: integer): string;
var
i, t: integer;
lc: array[0..14] of char;
const lchar:string ='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
begin
Result := '';
lc := '';
for i := 0 to vlen -1 do
lc[i] := lchar[Random(62) + 1];
Result := lc;
end;
var
t,i: Integer;
lstr: string;
begin
try
t := GetTickCount;
randomize;
for I := 1 to 10000000 do
begin
if i < 101 then
Writeln(GetRandomid(15))
else
GetRandomid(15);
end;
t := GetTickCount - t;
Writeln(Format('10000000次 %d 毫秒',[t]));
Readln(lstr);
except
on E: Exception do
Writeln(E.ClassName, ': ', E.Message);
end;
end.
————————————————
原文链接:https://blog.csdn.net/y281252548/article/details/99861704
Copyright © 2014 DelphiW.com 开发 源码 文档 技巧 All Rights Reserved
晋ICP备14006235号-8 晋公网安备 14108102000087号
执行时间: 0.11008095741272 seconds