mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-01 10:40:59 +02:00
* Patch from Thaddy De Koning to add generic RandomFrom
git-svn-id: trunk@36706 -
This commit is contained in:
parent
03267e3ba3
commit
162b938409
@ -613,8 +613,12 @@ function CompareValue ( const A, B : Extended; delta : Extended = 0.0 ) : TValue
|
||||
function RandomFrom(const AValues: array of Double): Double; overload;
|
||||
function RandomFrom(const AValues: array of Integer): Integer; overload;
|
||||
function RandomFrom(const AValues: array of Int64): Int64; overload;
|
||||
{$if FPC_FULLVERSION >=301010}
|
||||
generic function RandomFrom<T>(const AValues:array of T):T;
|
||||
{$endif}
|
||||
|
||||
{ cpu specific stuff }
|
||||
|
||||
type
|
||||
TFPURoundingMode = system.TFPURoundingMode;
|
||||
TFPUPrecisionMode = system.TFPUPrecisionMode;
|
||||
@ -2600,6 +2604,13 @@ begin
|
||||
result:=AValues[random(High(AValues)+1)];
|
||||
end;
|
||||
|
||||
{$if FPC_FULLVERSION >=301010}
|
||||
generic function RandomFrom<T>(const AValues:array of T):T;
|
||||
begin
|
||||
result:=AValues[random(High(AValues)+1)];
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
function FutureValue(ARate: Float; NPeriods: Integer;
|
||||
APayment, APresentValue: Float; APaymentTime: TPaymentTime): Float;
|
||||
var
|
||||
|
Loading…
Reference in New Issue
Block a user