Modeling and Simulation
Basics of Spreadsheet
Simulation
1
Basics of Spreadsheet Simulation
• In this module, we shall
see an overview of
spreadsheet simulation
• We shall also take a look
at simulating
randomness
2
How to Simulate Randomness
• Almost every simulation
we encounter needs at
least one random variable
• E.g. Coin Toss (Head vs.
Tail)
3
Another Example: Queue
• Arrival and departure rate
4
Taking a Step Back: What is Random?
• In the real world, the
number of factors
involved in any event are
so numerous that it can
be very difficult to predict
such events.
• In a computer, this can be
very hard to generate.
• Hence the concept of
“pseudo randomness”
5
General Steps
• Generate a number
between 0 and 1 –
referred to as the
“random number”
• “Random variable” is any
randomly generated
quantity with a specified
statistical distribution.
• A method of generating a
sequence of random
numbers is called a
Random Number
Generator (RNG)
6
Important Statistical Properties
• Number should be
uniformly distributed
between 0 and 1
• Subsequent numbers
should be statistically
independent of all
previous numbers
7
VBA in MS Excel
• We use the RAND
formula = RAND()
• More complex formulas
can be used e.g.
IF(RAND() <= 0.5, 0.1)
• Here IF checks the first
condition and if true,
returns the second one
8
VBA in MS Excel
• Another option is
RANDBETWEEN()
• Rnd01
• Discrete Uniform(min,
max)
• DiscreteEmp(rCumProb,
rValues)
• Uniform(low, high)
• NORMSINV(Rnd01())
• For manual simulation, we
can use coin toss or dice
(Impractical for anything
large however)
9
Summary
• In this module, we have
examined the basics of
simulation in spreadsheet
10