C claire_cn Unregistered / Unconfirmed GUEST, unregistred user! 2002-08-13 #1 1、怎样在两个指定的实数之间随机的取一个整数? 2、怎样在给定的一组整数中随机的取其中的某一个?
L LeeChange Unregistered / Unconfirmed GUEST, unregistred user! 2002-08-13 #2 1.function GetRandom(a, b: Double): Integer; var t: Double; x, y: Integer; begin if a>b then begin t:=a; a:=b; b:=t end; x:=Trunc(a+1); y:=Trunc(b); Return:=Random(y-x)+x end;
1.function GetRandom(a, b: Double): Integer; var t: Double; x, y: Integer; begin if a>b then begin t:=a; a:=b; b:=t end; x:=Trunc(a+1); y:=Trunc(b); Return:=Random(y-x)+x end;
L LeeChange Unregistered / Unconfirmed GUEST, unregistred user! 2002-08-13 #3 2. var a: array of Integer; ... Ran:=a[Random(Length(a))];
L LeeChange Unregistered / Unconfirmed GUEST, unregistred user! 2002-08-13 #5 Delphi6中有 1. RandomRange 2. RandomFrom
青 青山侠客 Unregistered / Unconfirmed GUEST, unregistred user! 2002-08-13 #7 LeeChange老兄,你的数组定义不当,没有指定元素个数恐怕不行!!!
L LeeChange Unregistered / Unconfirmed GUEST, unregistred user! 2002-08-13 #8 我对青山侠客的景仰有如滔滔江水,连绵不绝...