S szqhebei Unregistered / Unconfirmed GUEST, unregistred user! 2008-03-28 #1 我想随机生成±1.5---±2.5之间的数字,快急死了,大家快帮忙搞下吧,谢谢了
N nicai_wgl Unregistered / Unconfirmed GUEST, unregistred user! 2008-03-28 #4 randomize; if random(2) then result := (15 + random(11)) / 10 else result := -(15 + random(11)) / 10;
randomize; if random(2) then result := (15 + random(11)) / 10 else result := -(15 + random(11)) / 10;
D Delphiguanshui Unregistered / Unconfirmed GUEST, unregistred user! 2008-03-28 #5 提示: 可以設置生成兩個隨機數: for i = 1 to 2do random(i) 只會出現:0或1 可以設置為:0正1負 再設置隨機數:k 這個K就是你要的值,
P popoing Unregistered / Unconfirmed GUEST, unregistred user! 2008-05-30 #6 Randomize; I:= RandomRange(-2.5,2.5);
L linson110 Unregistered / Unconfirmed GUEST, unregistred user! 2008-07-23 #7 To popoing: RandomRange的参数必须是Integer; 可以改成这样: procedure TForm1.Button1Click(Sender: TObject); var i:double; begin Randomize; I:= RandomRange(-25,25); edit1.text:=floattostr(i / 10); end;
To popoing: RandomRange的参数必须是Integer; 可以改成这样: procedure TForm1.Button1Click(Sender: TObject); var i:double; begin Randomize; I:= RandomRange(-25,25); edit1.text:=floattostr(i / 10); end;