unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,math;
type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
i:integer;
s:char;
begin
edit1.Text :=chr(randomrange(65,90));
i:=1;
while i<15 do
begin
s:=chr(randomrange(65,90));
if pos(s,edit1.Text)=0 then
begin
edit1.Text:=edit1.Text+s;
i:=i+1;
end;
end;
end;
end.
// 在uses加 math