function RandomString(mChars: string; mLength: Integer): string; var I: Integer; begin Randomize; Result := ''; if mChars = '' then Exit; for I := 1 to mLength do Result := Result + mChars[Random(Length(mChars)) + 1]; end; { RandomString }procedure TForm1.Button1Click(Sender: TObject); begin Caption := RandomString('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ', 16); end;
var
I: Integer;
begin
Randomize;
Result := '';
if mChars = '' then Exit;
for I := 1 to mLength do
Result := Result + mChars[Random(Length(mChars)) + 1];
end; { RandomString }procedure TForm1.Button1Click(Sender: TObject);
begin
Caption := RandomString('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ', 16);
end;
然后合并