【Delphi 产生了范围随机数 条件可以自己改】

xiaoxiao2021-02-28  99

procedure TForm1.Button1Click(Sender: TObject);

var i:Integer; begin   //产生了100-999的数 条件可以自己改 Randomize; i := random(999); while (i < 100) do i := random(999); edit1.Text:=inttostr(i);

end;

 

第二种方法  单元添加user math

procedure TForm1.Button1Click(Sender: TObject); var a:integer; begin randomize; a:=randomrange(50,99); edit1.Text:=inttostr(a); end;

转载请注明原文地址: https://www.6miu.com/read-66781.html

最新回复(0)