D
DYI
Unregistered / Unconfirmed
GUEST, unregistred user!
delphi 生成16位,随机序列,以下代码如何修改,才能每次生成,包含h,k,l三个不同位置的序列!unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;var Form1: TForm1;implementation{$R *.dfm}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);beginCaption := RandomString('0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ', 16);end;end.