Generates a vector of random variates from a beta distribution with probability density function, \(f (X)\), where:
\[f (X) = \frac{\Gamma(A+B)}{\Gamma(A)\Gamma(B)}X^{A-1}(1-X)^{B-1}\]
if \(0 \le X \le 1 \ and \ A, B > 0.0\), otherwise \(f (X) = 0\).
C Generate 100 values from the Beta distribution
INTEGER LSTATE,N
PARAMETER (LSTATE=16,N=100)
INTEGER I,INFO,SEED(1),STATE(LSTATE)
DOUBLE PRECISION A,B
DOUBLE PRECISION X(N)
C Set the seed
SEED(1) = 1234
C Read in the distributional parameters
READ(5,*) A,B
C Initialize the STATE vector
CALL DRANDINITIALIZE(1,1,SEED,1,STATE,LSTATE,INFO)
C Generate N variates from the Beta distribution
CALL DRANDBETA(N,A,B,STATE,X,INFO)
C Print the results
WRITE(6,*) (X(I),I=1,N)