DELPHI XE 获取大写、小写、数字指定长度的随机数

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;




联系电话:
020-00000000
联系电话:
020-00000000
联系电话:
020-12345678