function TfrmMain.RandomString(ALength: Integer): string;
const
  Seeds = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
var
  I, Index: Integer;
begin
  Result := '';
  Randomize;
  for I := 0 to ALength - 1 do
  begin
    Index := Random(Seeds.Length);
    Result := Result + Seeds.Chars[Index];
  end;
end;
procedure TfrmMain.Button2Click(Sender: TObject);
begin
  edtToken.Text := RandomString(43);
  ShowMessage(Length(RandomString(43)).ToString);
end;

 

posted on 2020-08-10 14:03  redhat588  阅读(336)  评论(0编辑  收藏  举报