Coninuous Univariate#
BETA Distribution#
Generates a vector of random variates from a beta distribution with probability density function, \(f (X)\), where:
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)
Cauchy Distribution#
Generates a vector of random variates from a Cauchy distribution with probability density function, \(f (X)\), where:
C Generate 100 values from the Cauchy 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 Cauchy distribution
CALL DRANDCAUCHY(N,A,B,STATE,X,INFO)
C Print the results
WRITE(6,*) (X(I),I=1,N)
Chi-Squared Distribution#
Generates a vector of random variates from a χ2 distribution with probability density function, \(f (X)\), where:
if \(X > 0\), otherwise \(f (X) = 0\). Here ν is the degrees of freedom, DF.
C Generate 100 values from the Chi-squared distribution
INTEGER LSTATE,N
PARAMETER (LSTATE=16,N=100)
INTEGER I,INFO,SEED(1),STATE(LSTATE) INTEGER DF
DOUBLE PRECISION X(N)
C Set the seed
SEED(1) = 1234
C Read in the distributional parameters
READ(5,*) DF
C Initialize the STATE vector
CALL DRANDINITIALIZE(1,1,SEED,1,STATE,LSTATE,INFO)
C Generate N variates from the Chi-squared distribution
CALL DRANDCHISQUARED(N,DF,STATE,X,INFO)
C Print the results
WRITE(6,*) (X(I),I=1,N)
Exponential Distribution#
Generates a vector of random variates from an exponential distribution with probability density function, \(f (X)\), where:
if \(X > 0\), otherwise \(f (X) = 0\).
C Generate 100 values from the Exponential distribution
INTEGER LSTATE,N
PARAMETER (LSTATE=16,N=100)
INTEGER I,INFO,SEED(1),STATE(LSTATE)
DOUBLE PRECISION A
DOUBLE PRECISION X(N)
C Set the seed
SEED(1) = 1234
C Read in the distributional parameters
READ(5,*) A
C Initialize the STATE vector
CALL DRANDINITIALIZE(1,1,SEED,1,STATE,LSTATE,INFO)
C Generate N variates from the Exponential distribution
CALL DRANDEXPONENTIAL(N,A,STATE,X,INFO)
C Print the results
WRITE(6,*) (X(I),I=1,N)
F Distribution#
Generates a vector of random variates from an F distribution, also called the Fisher’s variance ratio distribution, with probability density function, \(f (X)\), where:
if \(X > 0\), otherwise \(f (X) = 0\). Here μ is the first degrees of freedom, (DF1) and ν is the second degrees of freedom, (DF2).
C Generate 100 values from the F distribution
INTEGER LSTATE,N
PARAMETER (LSTATE=16,N=100)
INTEGER I,INFO,SEED(1),STATE(LSTATE)
INTEGER DF1,DF2
DOUBLE PRECISION X(N)
C Set the seed
SEED(1) = 1234
C Read in the distributional parameters
READ(5,*) DF1,DF2
C Initialize the STATE vector
CALL DRANDINITIALIZE(1,1,SEED,1,STATE,LSTATE,INFO)
C Generate N variates from the F distribution
CALL DRANDF(N,DF1,DF2,STATE,X,INFO)
C Print the results
WRITE(6,*) (X(I),I=1,N)
Gamma Distribution#
Generates a vector of random variates from a Gamma distribution with probability density function, \(f (X)\), where:
if \(X > 0\) and \(A, B > 0.0\), otherwise \(f (X) = 0\).
C Generate 100 values from the Gamma 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 Gamma distribution
CALL DRANDGAMMA(N,A,B,STATE,X,INFO)
C Print the results
WRITE(6,*) (X(I),I=1,N)
Gaussian Distribution#
Generates a vector of random variates from a Gaussian distribution with probability density function, \(f (X)\), where:
Here μ is the mean, (XMU ) and \(\sigma 2\) the variance, (VAR) of the distribution.
C Generate 100 values from the Gaussian distribution
INTEGER LSTATE,N
PARAMETER (LSTATE=16,N=100)
INTEGER I,INFO,SEED(1),STATE(LSTATE)
DOUBLE PRECISION XMU,VAR
DOUBLE PRECISION X(N)
C Set the seed
SEED(1) = 1234
C Read in the distributional parameters
READ(5,*) XMU,VAR
C Initialize the STATE vector
CALL DRANDINITIALIZE(1,1,SEED,1,STATE,LSTATE,INFO)
C Generate N variates from the Gaussian distribution
CALL DRANDGAUSSIAN(N,XMU,VAR,STATE,X,INFO)
C Print the results
WRITE(6,*) (X(I),I=1,N)
Logistic Distribution#
Generates a vector of random variates from a logistic distribution with probability density function, \(f (X)\), where:
C Generate 100 values from the Logistic 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,*) XMU,VAR
C Initialize the STATE vector
CALL DRANDINITIALIZE(1,1,SEED,1,STATE,LSTATE,INFO)
C Generate N variates from the Logistic distribution
CALL DRANDLOGISTIC(N,A,B,STATE,X,INFO)
C Print the results
WRITE(6,*) (X(I),I=1,N)
Lognormal Distribution#
Generates a vector of random variates from a lognormal distribution with probability density function, \(f (X)\), where:
if X > 0, otherwise \(f (X) = 0\). Here μ is the mean, (XMU ) and \(\sigma 2\) the variance, (VAR) of the underlying Gaussian distribution.
C Generate 100 values from the Lognormal distribution
INTEGER LSTATE,N
PARAMETER (LSTATE=16,N=100)
INTEGER I,INFO,SEED(1),STATE(LSTATE)
DOUBLE PRECISION XMU,VAR
DOUBLE PRECISION X(N)
C Set the seed
SEED(1) = 1234
C Read in the distributional parameters
READ(5,*) XMU,VAR
C Initialize the STATE vector
CALL DRANDINITIALIZE(1,1,SEED,1,STATE,LSTATE,INFO)
C Generate N variates from the Lognormal distribution
CALL DRANDLOGNORMAL(N,XMU,VAR,STATE,X,INFO)
C Print the results
WRITE(6,*) (X(I),I=1,N)
Students T Distribution#
Generates a vector of random variates from a Students T distribution with probability density function, \(f (X)\), where:
Here ν is the degrees of freedom, DF.
C Generate 100 values from the Students T distribution
INTEGER LSTATE,N
PARAMETER (LSTATE=16,N=100)
INTEGER I,INFO,SEED(1),STATE(LSTATE)
INTEGER DF
DOUBLE PRECISION X(N)
C Set the seed
SEED(1) = 1234
C Read in the distributional parameters
READ(5,*) DF
C Initialize the STATE vector
CALL DRANDINITIALIZE(1,1,SEED,1,STATE,LSTATE,INFO)
C Generate N variates from the Students T distribution
CALL DRANDSTUDENTST(N,DF,STATE,X,INFO)
C Print the results
WRITE(6,*) (X(I),I=1,N)
Triangular Distribution#
Generates a vector of random variates from a Triangular distribution with probability density function, \(f (X)\), where:
if XMIN < X < XMED, else
if XMED < X < XMAX, otherwise \(f (X) = 0\).
C Generate 100 values from the Students Triangular distribution
INTEGER LSTATE,N
PARAMETER (LSTATE=16,N=100)
INTEGER I,INFO,SEED(1),STATE(LSTATE)
DOUBLE PRECISION XMIN,XMED,XMAX
DOUBLE PRECISION X(N)
C Set the seed
SEED(1) = 1234
C Read in the distributional parameters
READ(5,*) XMIN,XMED,XMAX
C Initialize the STATE vector
CALL DRANDINITIALIZE(1,1,SEED,1,STATE,LSTATE,INFO)
C Generate N variates from the Triangular distribution
CALL DRANDTRIANGULAR(N,XMIN,XMED,XMAX,STATE,X,INFO)
C Print the results
WRITE(6,*) (X(I),I=1,N)
Uniform Distribution#
Generates a vector of random variates from a Uniform distribution with probability density function, \(f (X)\), where:
C Generate 100 values from the Uniform 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 Uniform distribution
CALL DRANDUNIFORM(N,A,B,STATE,X,INFO)
C Print the results
WRITE(6,*) (X(I),I=1,N)
VonMises Distribution#
Generates a vector of random variates from a Von Mises distribution with probability density function, \(f (X)\), where:
where X is reduced modulo \(2\pi\) so that it lies between \(\pm \pi\), and κ is the concentration parameter VK.
C Generate 100 values from the Von Mises distribution
INTEGER LSTATE,N
PARAMETER (LSTATE=16,N=100)
INTEGER I,INFO,SEED(1),STATE(LSTATE)
DOUBLE PRECISION VK
DOUBLE PRECISION X(N)
C Set the seed
SEED(1) = 1234
C Read in the distributional parameters
READ(5,*) VK
C Initialize the STATE vector
CALL DRANDINITIALIZE(1,1,SEED,1,STATE,LSTATE,INFO)
C Generate N variates from the Von Mises distribution
CALL DRANDVONMISES(N,VK,STATE,X,INFO)
C Print the results
WRITE(6,*) (X(I),I=1,N)
Weibull Distribution#
Generates a vector of random variates from a Weibull distribution with probability density function, \(f (X)\), where:
if X > 0, otherwise \(f (X) = 0\).
C Generate 100 values from the Weibull 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 Weibull distribution
CALL DRANDWEIBULL(N,A,B,STATE,X,INFO)
C Print the results
WRITE(6,*) (X(I),I=1,N)