本文整理自网络,侵删。
function RandString(s: string; Min, Max: Integer): string;var count, i, r : Integer;begin Result := ''; if ((Max - Min) > 0) then begin count := Random(Max - Min + 1) + Min; for i := 0 to count - 1 do begin r := Random(Length(s)) + 1; Result := Result + s[r]; end; end;end;
procedure TForm1.Button1Click(Sender: TObject);beginshowmessage(RandString('ABCDEFGHIJKLMN',9,10));end;
相关阅读 >>
Delphi 时间与相关类型(2) - tdate、ttime、ttimestamp
Delphi 10.3 调试程序时出错:unable to create process:请求的操作需要提升
Delphi 10 seattle plus 新特性――system.json.builders
更多相关阅读请进入《Delphi》频道 >>