Generate a pseudorandom number from a beta distribution.
double
which specifies the first beta distribution parameter, . double
which specifies the second beta distribution parameter, . A double
which specifies a pseudorandom number from a beta distribution.
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.
Random Class | Imsl.Stat Namespace | Example