Namespace:
Imsl.Stat
Assembly:
ImslCS (in ImslCS.dll) Version: 6.5.0.0
Syntax
C# |
---|
public virtual double NextBeta( double p, double q ) |
Visual Basic (Declaration) |
---|
Public Overridable Function NextBeta ( _ p As Double, _ q As Double _ ) As Double |
Visual C++ |
---|
public: virtual double NextBeta( double p, double q ) |
Parameters
- p
- Type: System..::.Double
A double which specifies the first beta distribution parameter,.
- q
- Type: System..::.Double
A double which specifies the second beta distribution parameter,.
Return Value
A double which specifies a pseudorandom number from a beta distribution.
Remarks
Method NextBeta generates pseudorandom numbers from a beta distribution with parameters p and q, both of which must be positive. The probability density function is

where is the gamma function.
The algorithm used depends on the values of p and q. Except for the trivial cases of p = 1 or q = 1, in which the inverse CDF method is used, all of the methods use acceptance/rejection. If p and q are both less than 1, the method of Johnk (1964) is used; if either p or q is less than 1 and the other is greater than 1, the method of Atkinson (1979) is used; if both p and q are greater than 1, algorithm BB of Cheng (1978), which requires very little setup time, is used.
The value returned is less than 1.0 and greater than
, where
is the smallest positive number such
that
is less than 1.0.