0% found this document useful (0 votes)
70 views4 pages

Randgen Add-In: Installation

The RandGen add-in provides Excel functions for generating random numbers from various probability distributions. It is written as an XLL add-in, so it only works in Excel for Windows 2010 and later. To install it, open the RandGenSetup.zip file and follow the installation instructions. There are 14 functions that generate random numbers from different discrete and continuous distributions, like the normal, binomial, and Poisson distributions. A 15th function, Corr_, can be used to correlate random numbers based on a correlation matrix.

Uploaded by

KING KARTHIK
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views4 pages

Randgen Add-In: Installation

The RandGen add-in provides Excel functions for generating random numbers from various probability distributions. It is written as an XLL add-in, so it only works in Excel for Windows 2010 and later. To install it, open the RandGenSetup.zip file and follow the installation instructions. There are 14 functions that generate random numbers from different discrete and continuous distributions, like the normal, binomial, and Poisson distributions. A 15th function, Corr_, can be used to correlate random numbers based on a correlation matrix.

Uploaded by

KING KARTHIK
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

RandGen Add-In

The purpose of this add-in is to provide a collection of Excel functions for generating random numbers
from various well-known probability distributions. The functions in this add-in are intended to be used
with the author’s simulation program, to be packaged with his Data Analysis for Decision Making 7e
book, but they can be used for generating random numbers for any purpose.

The add-in is written as an XLL, a special type of DLL (dynamic-link library) that Excel understands. Its
code references several Excel functions, such as BINOM_INV, that were introduced in Excel 2010, so the
add-in shouldn’t be used for pre-2010 versions of Excel. Also, the add-in works only with Excel for
Windows; it does not work with Excel for the Mac.

Installation

To install the add-in, double-click the Setup.exe file inside the RandGenSetup.zip file and follow
instructions. Once it has been installed and you open the Excel Add-Ins list, you will see a RandGen item
that you can check or uncheck. (To see the Excel Add-Ins list, click Options from the File menu, then Add-
Ins, then the Go button at the bottom.)

The resulting random functions act just like built-in Excel functions. For example, you could enter the
formula =Normal_(100,10) in any cell to generate a normally distributed random number, or you could
then copy this formula to other cells to get several (independent) normally distributed random numbers.

There is no Help file associated with these functions, except what you’re reading now.

List of Random Functions

There are 14 random functions available, each for generating a random number from the corresponding
distribution. The first four are discrete distributions; the last 10 are continuous distributions. (There is
also a 15th function, Corr_, discussed below.)

Distribution Function and arguments Restrictions on arguments Comments


Bernoulli Bernoulli_(p) 0<=p<=1 1 if a success, 0
otherwise, where
success has
probability p
Binomial Binomial_(n,p) n>=0, 0<=p<=1 Number of successes
in n independent
trials, where p is the
probability of success
on each trial
Poisson Poisson_(mean) mean>0 Nonnegative integer-
valued, often used
for the number of
events in some
amount of time or
place
Discrete Discrete_(values,probs) # of values must match # of General discrete
probs, and probs must sum distribution where
to 1 values is any list of
possible values and
probs is the
corresponding list of
probabilities
Uniform Uniform_(min,max) min<=max Flat distribution,
where any value
between min and
max is equally likely
Normal Normal_(mean,stdev) stdev>0 Famous symmetric
bell-shaped
distribution with
given mean and
standard deviation
Triangular Triangular_(min,mostlikely,max) min<=mostlikely<=max Distribution bounded
by min and max, with
peak at mostlikely
value
Pert Pert_(min,mostlikely,max) min<=mostlikely<=max A “rounded” version
of the triangular
distribution
Beta Beta_(alpha1,alpha2,min,max) alpha1>0, alpha2>0, Bounded by min and
min<=max max, shape
determined by
alpha1 and alpha2
Exponential Exponential_(mean) mean>0 Nonnegative
“memoryless”
distribution with
given mean and
mode at 0
Erlang Erlang_(n,beta) n>0, n integer, beta>0 Right-skewed
nonnegative
distribution with
integer shape
parameter n and
mean equal to
n*beta
Gamma Gamma_(alpha,beta) alpha>0, beta>0 Generalization of
Erlang distribution
where the shape
parameter alpha can
be any nonnegative
value. Mean is
alpha*beta.
Lognormal Lognormal_(mean,stdev) mean>0, stdev>0 Right-skewed
nonnegative
distribution with
given mean and
standard deviation
Weibull Weibull_(alpha,beta) alpha>0, beta>0 Right-skewed
nonnegative
distribution with
shape parameter
alpha and scale
parameter beta.
Mean is a complex
function of alpha and
beta.

Notes:

1. Don’t forget that each of these functions has an underscore (_) at the end of its name.
2. Like built-in Excel functions, each argument of these random functions can be a cell reference. In
particular, the arguments of the Discrete_ function can be references to ranges of values and
probabilities.
3. If you supply an “illegal” argument to any of these functions, you will get a #NUM! error. For
example, =Normal_(10,-2) will produce this error.

Correlating Random Numbers

The Corr_ function, in conjunction with the author’s simulation program, lets you correlate random
numbers. It has two arguments: an index of the variable being correlated and a reference to a
correlation matrix. The following example illustrates its use:

Notes:

1. In this example, the indexes are 1, 2, and 3, corresponding to the rows (or columns) of the
correlation matrix. For example, the random numbers in cells A1 and C1, with indexes 1 and 3,
have correlation 0.4.
2. Unless the first argument is not an integer, the Corr_ function returns the value 0, so adding it to
a function like Normal_ doesn’t change the latter function’s value. If the first argument is not an
integer, the Corr_ function returns a #NUM! error.
3. As this example illustrates, you can correlate random values from the same distribution or from
different distributions.
4. Without the author’s simulation program, the Corr_ function has no effect. This simulation
program checks that (1) the correlation matrix is square (# of rows equals # of columns), (2) the
indexes of the variables go from 1 to then size of the correlation matrix, and (3) the correlation
matrix has “valid” correlations (meaning that there exists a data set that could produce this
correlation matrix, or, more technically, the matrix is positive semidefinite). If these conditions
hold, the simulated values of the variables are then correlated according to the correlations in
the correlation matrix.

You might also like