Assembly: ImslCS (in ImslCS.dll) Version: 6.5.0.0
Syntax
C# |
---|
public virtual double NextChiSquared( double df ) |
Visual Basic (Declaration) |
---|
Public Overridable Function NextChiSquared ( _ df As Double _ ) As Double |
Visual C++ |
---|
public: virtual double NextChiSquared( double df ) |
Parameters
- df
- Type: System..::.Double
A double which specifies the number of degrees of freedom. It must be positive.
Return Value
A double which specifies a pseudorandom number from a Chi-squared distribution.Remarks
NextChiSquared generates pseudorandom numbers from a chi-squared distribution with df degrees of freedom. If df is an even integer less than 17, the chi-squared deviate r is generated as
where and the are independent random deviates from a uniform (0, 1) distribution. If df is an odd integer less than 17, the chi-squared deviate is generated in the same way, except the square of a normal deviate is added to the expression above. If df is greater than 16 or is not an integer, and if it is not too large to cause overflow in the gamma random number generator, the chi-squared deviate is generated as a special case of a gamma deviate, using NextGamma. If overflow would occur in NextGamma, the chi-squared deviate is generated in the manner described above, using the logarithm of the product of uniforms, but scaling the quantities to prevent underflow and overflow.