Random_ChiSq Routines
Generates a random variate from the Chi-Squared Distribution with given degrees of freedom.

Unit
QESBPCSRandom

Overloaded Variants
Function Random_ChiSq(const DF: Integer): Extended;
Function Random_ChiSq(const DF: Integer; RandomGenerator: TRandomGenFunction): Extended;

Declaration
Function Random_ChiSq(const DF: Integer): Extended;

Parameters
DF Degrees of Freedom - must be positive.
RandomGenerator Optional Function to use for Uniform Random Number Generator. If omitted, Delphi's Random function is used, and if this is done remember to call Randomize if you don't want repeated values.

Category
Arithmetic Routines for Floats

Implementation

function Random_ChiSq (const DF: Integer): Extended;
begin
     Result := Random_ChiSq (DF, DelphiRandom);
End;

Declaration
Function Random_ChiSq(const DF: Integer; RandomGenerator: TRandomGenFunction): Extended;

Implementation

function Random_ChiSq (const DF: Integer;
     RandomGenerator: TRandomGenFunction): Extended;
begin
     Result := 2.0 * Random_Gamma (0.5 * DF, RandomGenerator)
End;


HTML generated by Time2HELP
http://www.time2help.com