Monte Carlo Simulation Examples
Six short simulations that show the variety of ways Monte Carlo methods apply to dynamic and static stochastic modeling problems
© 2026 Theodore P. Pavlic
· MIT License

One queue feeds one or two identical servers, and each replication runs to an end time T through the spreadsheet: arrival, service begins, wait, service ends. A customer still in the queue when the clock stops is shown but not counted. The arrival rate, the service rate, the number of servers, and the end time are the decisions, and the thresholds ask how long the waits may run and how busy the servers stay. Adapted from Banks, Carson, Nelson, and Nicol (2010, Sections 2.3.2 and 2.3.3).

Inputs and decision
InputDistribution
Interarrival timeExponential, rate λ per minute (mean 1/λ min)
Service timeExponential, rate μ per minute (mean 1/μ min), each server
Traffic intensity, ρ = λ/(cμ) = 0.80 Steady-state wait, Wq = ρ/(μ − λ) = — min
Servers and the queue over time
The rug on top marks every event. Below it, each bar is one customer's service on the server that took it, from the moment the customer reaches the server to the moment it leaves; a customer still waiting has no bar yet. The step plot counts customers waiting; hover or tap it to see who is waiting at that instant. In the rug, a tick up (blue) is an arrival and a tick down (red) is a departure, each with its own readout on hover or tap. Hover or tap a bar for that service's start, end, and length. Hover a row or a bar to link them; click to pin the pair, and click again to release. The running average above uses only the counted customers revealed so far. Drag the dashed T line to change the end time; the spinner above does the same.
One replication
Many replications
Average wait, fraction of runs
Longest wait, fraction of runs
Server utilization, fraction of runs Success thresholds to
Experiment log

This model carries state from day to day: unmet demand becomes a backorder, and an order placed at a review arrives days later. Two outputs pull against each other: the stock carried costs money every day it sits, and every backordered refrigerator costs more, and M and N move both. Adapted from Banks, Carson, Nelson, and Nicol (2010, Section 2.4.2).

Inputs and decision
Day 0 starts with 3 on hand and an order of M − 3 due in 2 days.
Inventory over the 25 days
Stock by day: on hand above zero, backordered below it. Orders in flight are the arrows above, and dotted verticals are reviews. A filled dot is an end-of-day value; a hollow dot is the start of a day on which an order arrived. Hover or tap the curve for a day's numbers, click a point to highlight that day in the table, or hover a table row to find its point on the curve. Hover a row or a mark to link them; click to pin the pair, and click again to release. Drag the dashed M line up or down, or any dotted review line left or right, to change M or N; the spinners above do the same.
One replication
Many replications
25-day cost, fraction of runs
Days with a shortage, fraction of runs
Average ending inventory, fraction of runs
Experiment log

Each replication runs three bearing positions for 20,000 operating hours under one replacement policy. Replacing on failure waits for the mechanic every time; replacing all three at once discards remaining life. The output is dollars per 10,000 bearing-hours. Adapted from Banks, Carson, Nelson, and Nicol (2010, Example 2.9).

Inputs and decision
CostValue
Bearing$32 each
Downtime$10 per minute, waiting and during the change
Mechanic$30 per hour during the change
Change time20 min for one bearing, 40 min for three
Life is the operating hours a bearing runs before it fails; delay is the wait for the mechanic once one has. Both are drawn from the tables by inverse transform, a life for every bearing installed and a delay for every replacement event.
Bearing lifetimes and replacements
a bearing in service
remaining life, full when installed, gone at failure
life a replacement cut off
where the replacement cut it
failure
planned replacement (age policy)
all three replaced after a failure (set policies)
planned time reached (age policy)
planned time pre-empted by a failure (age policy)
the event linked to the table row under the pointer
Each lane is one bearing position over 20,000 operating hours. Under the age policy, triangles on the time axis mark each cycle's planned age: filled when the set reached it, hollow when a failure replaced the set first and restarted the clock. Hover a row or a mark to link them; click to pin the pair, and click again to release.
One replication
Many replications
Cost per 10,000 bearing-hours, fraction of runs
Experiment log

Twenty days of a newsstand make one replication, and the one decision is Q, the papers bought each morning. Below, the histogram of 20-day profit and the probability that a replication clears the threshold change as Q changes. Adapted from Banks, Carson, Nelson, and Nicol (2010, Section 2.4.1).

Inputs and decision: how one day is built
Two uniforms per day: the first picks the type of day, which picks a demand column; the second picks the demand from that column. Demand meets Q, and profit follows. Each colored quantity in the profit line comes from the box of the same color.
Each type of day has its own demand distribution. The day's type is drawn first and picks the column the demand is drawn from.
One replication
Many replications
20-day profit, fraction of runs
Experiment log

Each replication releases n packages, and the count inside the zone is the output. Raising n raises the count, and the threshold asks how many packages are needed for enough to land. Adapted from Banks, Carson, Nelson, and Nicol (2010, Section 2.5.2).

Inputs and decision
A package misses the aim point by an independent normal draw in each direction; drag a slider to change that direction's spread, and the map and the exact p follow as it moves. The zone is the delivery target, an octagon about 1.2 km across.
Exact hit probability per package, p =
Where the packages land
delivery zone fewer landings per m²more
Landing points for the current replication, on the landing distribution in gray; the last 20 replications of this batch stay faded behind, and a new batch clears them. Filled blue: in the zone. Red cross: outside. The exact p is the gray mass inside the zone; hover or tap an empty spot to read the mass on that side of it. Hover a row or a point to link them; click to pin the pair, and click again to release.
One replication
Many replications
Packages in the zone, fraction of runs
Experiment log

Three chains of steps run in parallel, and the shipment leaves when the last one finishes. Every chain has the same mean and range, but a chain of four steps is rarely all long or all short at once, and so its total is concentrated near the mean where a single step's is flat. Adapted from the activity network in Banks, Carson, Nelson, and Nicol (2010, Section 2.5.4), with a different network.

Inputs
Every path has mean 8 h and range 4 to 12 h. The paths differ only in how many steps share that range.
The network and its paths
Each path's steps, labeled with their distribution above and, once drawn, the duration below. The critical path is highlighted once every step is revealed.
Packing total, fraction of runs
Paperwork total, fraction of runs
Inspection total, fraction of runs
Longest path, fraction of runs
One replication
Many replications
Finish time (h), fraction of runs
Experiment log