Y yifeng Unregistered / Unconfirmed GUEST, unregistred user! 1999-06-05 #2 random(X) (+randomize)可以生成0--X范围内的随机数 Randomize; for I := 1 to 50do begin { Write to window at random locations } Canvas.TextOut(Random(Width), Random(Height), 'Boo!'); end; 你如果要其他范围,可以编程过滤掉不再范围内的数字
random(X) (+randomize)可以生成0--X范围内的随机数 Randomize; for I := 1 to 50do begin { Write to window at random locations } Canvas.TextOut(Random(Width), Random(Height), 'Boo!'); end; 你如果要其他范围,可以编程过滤掉不再范围内的数字
J jghuang Unregistered / Unconfirmed GUEST, unregistred user! 1999-06-05 #3 procedure myrandom(a,b:integer):integer; begin radomize; if a<=b then result:=random(b-a)+a else result:=random(a-b)+b; end;
procedure myrandom(a,b:integer):integer; begin radomize; if a<=b then result:=random(b-a)+a else result:=random(a-b)+b; end;