我想得到一组8位的随机函数,我是这样写的:
procedure TForm1.Button1Click(Sender: TObject);
begin
 Edit1.Text := InttoStr(Random(11111111));
end;
可是当我第一次按Button的时候Edit中却显示的为0,第二次以后就正常了。请问各位大虾为什么?
(在线等)

解决方案 »

  1.   

    procedure TForm1.Button1Click(Sender: TObject);
    begin
    Randomize;
     Edit1.Text := InttoStr(Random(11111111));
    end;
      

  2.   

    procedure TForm1.Button1Click(Sender: TObject);
    var
    a:integer;
    begin
    randomize;
    a:=round(Random*100000000);
    Edit1.Text := inttostr(a);
    edit2.text:=inttostr(length(Edit1.Text));
    end;
      

  3.   

    procedure TForm1.Button1Click(Sender: TObject);
    begin
    Randomize;
    Edit1.Text := InttoStr(Random(999999999));
    end;
      

  4.   

    需要Randomize初始化的!http://lysoft.7u7.net
      

  5.   

    Randomize;
    Edit1.Text := InttoStr(Random(999999999));