Statistics and Probability Simulation Methods Random Sampling 15 min read Updated November 21, 2026
BY: Minsa A (Senior Statistics Editor)
Reviewed By: Statistics Fundamentals Team

Monte Carlo Simulation

Monte Carlo simulation is a computational method that uses repeated random sampling to estimate the range of possible outcomes for an uncertain process. Instead of solving a problem analytically, it draws thousands of random inputs from probability distributions, runs the model for each one, and builds a distribution of outputs — revealing not just what will likely happen, but how likely each outcome is. The name comes from the Monte Carlo Casino in Monaco, used as a code name for the method's secret origins in 1940s nuclear weapons research.

What Is It? ↓ How It Works ↓ Steps ↓ Examples ↓ Python 3 Code ↓ Finance Example ↓ History ↓

What Is Monte Carlo Simulation?

Definition — Featured Snippet

Monte Carlo simulation is a technique that runs a model repeatedly with randomly sampled inputs — drawn from probability distributions — to build a picture of all possible outputs and how likely each one is. When a problem has too many uncertain moving parts for a clean analytical answer, Monte Carlo replaces the single guess with a distribution of outcomes backed by thousands of trials.

The core insight is straightforward. When a problem has uncertain inputs, running the model once with average values tells you the average-case answer — but tells you nothing about how wrong that answer might be, how wide the spread of outcomes is, or how often you might end up in a bad scenario. Monte Carlo simulation sidesteps that limitation. Instead of plugging in one set of inputs, it draws thousands of plausible input combinations from their probability distributions, runs the model for each one, and collects all the outputs into a distribution you can analyze.

Three things distinguish Monte Carlo from other analytical methods. First, it works on models that have no closed-form solution — the kind of problem where "solve for x" hits a wall. Second, it handles many uncertain inputs at the same time, something classical probability can struggle with as complexity grows. Third, it produces a distribution of outputs rather than a point estimate, so you can read off percentiles, tail probabilities, and the full spread of risk in a single analysis.

The method is not sensitivity analysis. Sensitivity analysis varies one input at a time while holding the others fixed, which reveals which knobs matter most but misses interactions between inputs. Monte Carlo varies all uncertain inputs together, sampling each from its own distribution on every run. The two methods complement each other — sensitivity analysis to understand leverage, Monte Carlo to understand the full risk envelope.

Monte Carlo Simulation

All inputs vary together

Samples every uncertain input simultaneously from its probability distribution. Produces a full output distribution revealing probability at each outcome level.

Sensitivity Analysis

One input varies at a time

Changes one input while holding others fixed. Identifies which inputs have the most leverage — but misses the combined effect of multiple inputs shifting together.

How Does Monte Carlo Simulation Work?

The method runs in four logical stages. Each stage is straightforward on its own; the power comes from repeating stages three and four thousands of times.

Step 1 — Build the Model

Start with a mathematical relationship between inputs and an output you care about. This can be as simple as a one-line formula — Profit = Revenue − Costs — or as complex as a multi-stage financial model, an engineering stress calculation, or a supply-chain simulation. The model defines the problem; the simulation handles the uncertainty.

Step 2 — Assign Probability Distributions

Every uncertain input needs a probability distribution. The distribution encodes what you know (and don't know) about how that input behaves. Three distributions cover the majority of real-world cases:

  • Normal distribution — for quantities that cluster around a mean with symmetric spread, such as daily revenue, component tolerances, or measurement error. See the normal distribution guide for the underlying mechanics.
  • Uniform distribution — for quantities that are equally likely anywhere within a range, such as a delivery time that could be anywhere from 2 to 5 days with no preference for any particular value.
  • Triangular distribution — for quantities where you know the minimum, the maximum, and the most likely value, such as project task durations in schedule risk analysis.

Choosing the wrong distribution is the most consequential mistake in a Monte Carlo analysis. The inputs are random variables, and the quality of the output distribution depends entirely on how accurately the input distributions reflect reality. Garbage in, garbage out applies here as precisely as anywhere in statistics.

Step 3 — Run the Simulations

Draw one random value from each input distribution, plug the values into the model, record the output — that is one simulation. Repeat N times. For most practical problems N sits between 1,000 and 10,000; tail-risk or rare-event problems may need 100,000 or more.

ℹ️
Pseudo-random number generators: deterministic by design

Most Monte Carlo implementations use a pseudo-random number generator (PRNG), not a truly random physical process. PRNGs are mathematically deterministic: given the same starting seed, they always produce the same sequence of numbers. Setting random.seed(42) in Python, for example, makes every run identical — which is a feature, not a flaw. Reproducibility is essential for verification, debugging, and regulatory audits. The sequence is statistically indistinguishable from random for practical purposes, but it is not "unpredictable" in any fundamental sense.

The key precision rule to know: sampling error decreases as 1/√N. Doubling precision requires four times as many simulations. Getting ten times more precision requires one hundred times as many simulations. This slow convergence is why there is no single "correct" N — the right number depends on how much precision the problem actually needs, and adding more simulations beyond that point costs computation time without meaningfully changing the answer.

Simulations (N) Relative Precision Typical π Accuracy Practical Use Case
1001×±0.32 (1 decimal place)Quick sanity check only
1,0003.2×±0.10Simple mean or probability estimates
10,00010×±0.032 (2 decimal places)Most financial and engineering models
100,00031.6×±0.010 (3 decimal places)Tail-risk and rare-event estimation
1,000,000100×±0.003High-precision physics or regulatory work

Step 4 — Analyze the Results

Plot the N output values as a histogram. The shape of that histogram is your answer. From it, read off: the mean (the expected outcome), the standard deviation (the spread), the 5th percentile (a downside scenario), the 95th percentile (an upside scenario), and any threshold probability that matters to your decision — P(NPV < 0), P(project finishes late), P(system fails under load). Those numbers, taken together, give a far richer picture than any single point estimate. The descriptive statistics guide covers how to interpret the shape of an output distribution once you have it, and the confidence intervals page explains how to build formal precision bounds around Monte Carlo estimates.

Monte Carlo Simulation Steps

  1. 1Define the problem and the output of interest. Name exactly what you are trying to estimate — revenue, cost, time to completion, probability of failure — and write the formula or model that produces it from its inputs.
  2. 2Identify all uncertain inputs and assign each a probability distribution. Normal for bell-shaped variation, uniform for equal-likelihood ranges, triangular when you know min/max/mode. Any input you treat as fixed should be one you are genuinely confident about.
  3. 3Set the number of simulations N. Use 1,000–10,000 for most practical problems. For rare-event probabilities or high-stakes decisions, use 100,000 or more. Set a random seed for reproducibility.
  4. 4For each simulation, draw one random value from each input distribution and compute the output. Store the result. Repeat N times without changing the model.
  5. 5Plot the N outputs as a histogram. The shape of this histogram is the probability distribution of your outcome, empirically derived from the simulation.
  6. 6Report summary statistics and threshold probabilities. Mean, standard deviation, 5th and 95th percentiles, and any P(outcome < threshold) your decision requires.

Monte Carlo Simulation Examples

Three examples ranging from a classic mathematical demonstration to a practical finance application. Each one shows the method from setup through interpretation.

Example 1 — Estimating π

This is the most intuitive Monte Carlo demonstration. No prior probability knowledge is needed to follow it, and it shows exactly why the method works.

Example 1 — Classic π Estimation

Using random points to approximate the value of π

Draw a 1×1 square. Inside it, draw a quarter-circle of radius 1 centered at the bottom-left corner. Scatter random points across the square and count what fraction lands inside the quarter-circle.

1

Setup: Generate a random point (x, y) where both x and y are drawn uniformly from [0, 1]. This represents a random position within the unit square.

2

Test: Check whether x² + y² ≤ 1. If true, the point falls inside the quarter-circle. If false, it falls outside.

3

Count: Repeat N times, tracking how many points land inside the quarter-circle.

4

Estimate: π ≈ 4 × (points inside circle) ÷ (total points)

✓ Why it works: the quarter-circle has area πr²/4 = π/4. The square has area 1. The fraction of random points that fall inside the quarter-circle converges to π/4 as N grows. Multiply by 4 to recover π.

⚠️
A common error — ratio direction

Some descriptions state that "the ratio of points inside the square to points inside the circle" estimates π. That is reversed. The correct ratio is inside circle divided by total points (circle-to-square), which gives π/4. Inverting it gives 4/π ≈ 1.273 — not π.

With N = 10,000 points the standard error of the estimate is roughly ±0.032 at 95% confidence — about two decimal places of accuracy. Getting one more decimal place requires multiplying N by one hundred, a direct consequence of the 1/√N convergence law.

Python 3 Code — π Estimation

The following code runs correctly in Python 3. The seed makes the result reproducible. All division is floating-point; there are no curly quotes or Python 2 syntax.

Python 3 — copy-paste ready
import random

random.seed(42)          # set seed for reproducibility

N = 10_000
inside = 0

for _ in range(N):
    x = random.uniform(0, 1)
    y = random.uniform(0, 1)
    if x**2 + y**2 <= 1:
        inside += 1

pi_estimate = 4 * inside / N
print(f"Estimated π: {pi_estimate:.4f}")
# Typical output: Estimated π: 3.1464

To use NumPy for faster vectorized computation — which matters when N is large:

Python 3 — NumPy version (faster at large N)
import numpy as np

rng = np.random.default_rng(seed=42)   # modern NumPy random generator
N = 100_000

x = rng.uniform(0, 1, N)
y = rng.uniform(0, 1, N)

inside = np.sum(x**2 + y**2 <= 1)
pi_estimate = 4 * inside / N
print(f"Estimated π: {pi_estimate:.4f}")
# Typical output: Estimated π: 3.1416
✓
Why set a seed?

Python's random module uses the Mersenne Twister algorithm — a pseudo-random number generator that is deterministic given a seed. Setting random.seed(42) means anyone running this code gets the same sequence of "random" numbers, and therefore the same result. This is essential for reproducible science, debugging, and sharing analysis. It is not a quirk to work around; it is a deliberate design feature of PRNGs.

Example 2 — Project NPV Risk Analysis

This is where Monte Carlo earns its place in business and finance. A point estimate of expected profit tells you nothing about how often you might actually lose money.

Example 2 — Finance

Quantifying downside risk in a project investment decision

A project has uncertain revenue (normally distributed: mean $500,000, SD $80,000) and uncertain costs (normally distributed: mean $350,000, SD $60,000). Net Present Value = Revenue − Costs. What is the probability of losing money?

1

Point estimate: $500,000 − $350,000 = $150,000 expected NPV. This says nothing about the spread.

2

Monte Carlo: Run 10,000 simulations. Each draws one revenue value and one cost value from their respective normal distributions, then computes NPV.

3

Output distribution: Mean NPV ≈ $150,000. Standard deviation of NPV ≈ $100,000 (from √(80² + 60²) × $1,000 since the two inputs are independent normals).

4

Downside probability: P(NPV < 0) = P(Z < −1.5) ≈ 6.7% — there is roughly a 1-in-15 chance of a loss.

✓ The point estimate ($150,000) is correct on average, but hides a 6.7% chance of loss. Monte Carlo makes that risk visible and quantifiable — the information a decision-maker actually needs.

🚫
A critical error to avoid in finance: averaging rates before pricing

When running Monte Carlo on bond prices or any other nonlinear instrument: simulate each rate path → price the bond on that path → average the prices. Do not average the simulated rates and then price at the average rate. Bond price is a convex function of yield, so by Jensen's inequality, E[price(r)] > price(E[r]). Averaging rates first produces a systematically low (biased) bond price. This error appears in several widely-cited financial education resources.

Example 3 — The Chevalier de Méré Dice Problem

The 17th-century French gambler Chevalier de Méré posed a famous puzzle to Blaise Pascal: what is the probability of rolling at least one "double six" (both dice showing 6) in 24 rolls of two dice?

The exact answer, via probability rules, is 1 − (35/36)²⁴ ≈ 0.491. The chance is just under 50%. Monte Carlo reaches the same answer through brute force: simulate 10,000 experiments of 24 dice-pair rolls each; count how many contain at least one double six. The simulated proportion converges close to 0.491 as the number of experiments grows — a direct demonstration that the method works without needing to know the analytical formula.

Monte Carlo Simulation Applications

The method is domain-agnostic. Any problem with uncertain inputs and a computable model is a candidate. These four areas account for the bulk of real-world use.

📈

Finance and Investment

Portfolio risk, option pricing, project NPV, stress testing, and value-at-risk (VaR). Monte Carlo is the standard tool for quantifying probability and risk in investment decisions when distributions are non-normal or returns are path-dependent.

📋

Project Management

Schedule risk analysis. When task durations are uncertain, Monte Carlo produces a distribution of project completion dates. The P80 date — when there is an 80% chance of finishing — is a standard deliverable in infrastructure and construction projects. See also sales forecasting with regression for a related planning application.

⚙️

Engineering and Reliability

Estimating the probability that a system fails given uncertain component lifetimes, manufacturing tolerances, and variable loads. Aerospace, nuclear, and civil engineering rely on Monte Carlo for safety analyses where failures have severe consequences.

⚛️

Physics and Science

The original application: neutron diffusion in nuclear reactors. Today the list extends to particle physics, climate modeling, computational chemistry, and quantum mechanics — anywhere that the underlying system is too complex for analytical solution. See Markov Chain Monte Carlo for the probabilistic sampling extension used in Bayesian statistics.

Advantages and Limitations of Monte Carlo Simulation

What Monte Carlo does well

Monte Carlo handles multiple uncertain inputs at the same time without requiring independence between them, as long as you model any correlations explicitly. It works on models where no closed-form solution exists — the realistic case for most engineering, logistics, and financial problems of any real complexity. It scales naturally with parallel computation since each simulation run is independent. And it produces a full output distribution: not just an expected value, but the entire shape of risk and uncertainty in a single analysis.

The output is also transparent and auditable. Every simulated scenario exists as a data point you can inspect, which matters in regulated industries where you may need to justify your analysis to an external reviewer.

Where Monte Carlo falls short

The 1/√N convergence rate is both a core property and a limitation. Accuracy improves slowly: cutting estimation error in half requires four times as many simulations. For computationally expensive models — finite element analyses, computational fluid dynamics, complex multi-step financial models — reaching adequate precision can be costly.

The method also requires you to specify input distributions upfront. If you get those distributions wrong — using normal when the true distribution has fat tails, or ignoring correlations between inputs — the output distribution will be wrong in ways that may not be obvious. Monte Carlo is powerful but not self-correcting; it faithfully propagates whatever assumptions you bring to it. For a broader look at how statistical assumptions affect results, the statistical assumptions guide covers the topic across common test types. The sampling distributions page explains how sample size affects the precision of estimates in related contexts.

A Brief History of Monte Carlo Simulation

Origin: Los Alamos, 1946–1947

1946 Stanislaw Ulam, recovering from an illness and playing solitaire, begins thinking about the probability of a successful Canfield game. He realizes that simulating many random card arrangements would answer the question faster than combinatorial analysis. He brings the idea to John von Neumann.
1947 Ulam and von Neumann formalize the method at Los Alamos National Laboratory and apply it to neutron diffusion — modeling how neutrons move through fission material in nuclear weapons. The problem has no tractable analytical solution; random sampling makes it computable.
1947 Nicholas Metropolis coins the name "Monte Carlo" as a code name for the classified project, referencing the Monte Carlo Casino in Monaco — a nod to chance, secrecy, and the method's reliance on random numbers. The name sticks.
1977 Phelim Boyle publishes the first paper applying Monte Carlo simulation to option pricing — the method's entry into finance, more than 30 years after its invention. Finance is not where Monte Carlo began; that origin story belongs to nuclear physics.
Today Monte Carlo methods underpin modern quantitative finance, Bayesian statistics (see Markov Chain Monte Carlo), climate science, engineering reliability, and machine learning. The core idea — repeat random trials to understand uncertainty — has not changed since Ulam's solitaire game.
📌
Setting the record straight on origin

At least one widely-read source states that Monte Carlo simulation "originated in finance." This is incorrect. The method was developed at Los Alamos for nuclear physics in 1946–1947. Its entry into finance (Boyle 1977) came three decades later. The primary source is Eckhardt, R. (1987), "Stan Ulam, John von Neumann, and the Monte Carlo Method," Los Alamos Science, Special Issue, pp. 131–141.

Frequently Asked Questions

What is Monte Carlo simulation? ▼

Monte Carlo simulation is a computational method that uses repeated random sampling to estimate the probability of different outcomes in a process that cannot be predicted deterministically. It works by defining probability distributions for uncertain inputs, drawing thousands of random samples from those distributions, running a model for each sample, and analyzing the resulting distribution of outputs. The method is named after the Monte Carlo Casino in Monaco, where the uncle of physicist Stanislaw Ulam — one of the method's inventors — often gambled.

How does Monte Carlo simulation work? ▼

Monte Carlo simulation works in four steps: (1) Define a mathematical model that links uncertain inputs to an output of interest. (2) Assign a probability distribution to each uncertain input, such as normal, uniform, or triangular. (3) Randomly sample values from those distributions thousands of times, running the model for each set of inputs. (4) Analyze the collection of outputs as a distribution — using its mean, standard deviation, and percentiles — to understand the range and likelihood of possible outcomes.

What is an example of Monte Carlo simulation? ▼

A classic example is estimating π. Randomly place points inside a 1×1 square. Each point either falls inside the quarter-circle of radius 1 centered at the origin (if x² + y² ≤ 1) or outside it. Because the quarter-circle's area is π/4 and the square's area is 1, the fraction of points inside the circle converges to π/4 as the number of points increases. Multiply by 4 to estimate π. With 10,000 random points, this typically gives π accurate to about two decimal places.

What is the difference between Monte Carlo simulation and sensitivity analysis? ▼

Sensitivity analysis varies one input at a time while holding all others fixed, to identify which inputs have the most impact on the output. Monte Carlo simulation varies all uncertain inputs simultaneously by sampling them from their probability distributions, producing a full distribution of possible outputs. Monte Carlo gives a richer picture of uncertainty but requires specifying distributions for each input; sensitivity analysis is simpler but misses interactions between inputs.

How many simulations does Monte Carlo need to be accurate? ▼

The required number of simulations depends on the desired precision and the variability of the model. For estimating a simple probability or mean, 1,000–10,000 simulations usually provides adequate accuracy. For rare-event probabilities or tail-risk estimation, 100,000 or more may be needed. There is no universal rule: more simulations reduce sampling error, but the right number is determined by the precision requirements of the specific problem, not by a fixed threshold.

Who invented Monte Carlo simulation? ▼

Monte Carlo simulation was developed by Stanislaw Ulam and John von Neumann at Los Alamos National Laboratory around 1946–1947, originally to model neutron diffusion in nuclear weapons design. The name "Monte Carlo" was coined by physicist Nicholas Metropolis, after the Monte Carlo Casino in Monaco, referencing the role of chance in the method. The name was chosen as a code name for the secret wartime work and stuck.

What is the difference between Monte Carlo simulation and deterministic models? ▼

A deterministic model takes a fixed set of inputs and produces a single output — the same inputs always give the same answer. It tells you the expected-case result but nothing about variability or risk. Monte Carlo simulation treats inputs as probability distributions, running the model thousands of times with different input combinations drawn from those distributions. The result is a distribution of outputs rather than a single number, which lets you read off probabilities, percentiles, and tail risks. See the hypothesis testing guide for how probability distributions are used to make formal decisions under uncertainty.

Key Takeaways

📌

Monte Carlo simulation replaces a single point estimate with a distribution of outcomes, built from thousands of randomly sampled input combinations.

📌

The four steps: build the model → assign distributions to inputs → run N simulations → analyze the output distribution.

📌

Sampling error decreases as 1/√N. Halving the error costs 4× more simulations. There is no magic universal N — the right number depends on required precision.

📌

Most implementations use pseudo-random number generators that are deterministic given a seed. Setting a seed enables reproducibility — a feature, not a limitation.

📌

Monte Carlo is not sensitivity analysis. Sensitivity analysis moves one input at a time; Monte Carlo moves all uncertain inputs together from their distributions.

📌

In the π estimation example, the correct ratio is circle-to-square (inside circle ÷ total points = π/4), not square-to-circle. Multiplying by 4 gives π.

📌

In finance, always price each simulated path, then average prices. Averaging rates first and pricing at the average rate produces a biased result due to Jensen's inequality.

📌

The method was invented at Los Alamos in 1946–1947 for nuclear physics — not in finance. Finance applications came with Boyle's 1977 option pricing paper, three decades later.

Related topics: Random Variables · Normal Distribution · Hypothesis Testing · Confidence Intervals · Statistics and Probability · Sampling Distributions · Markov Chain Monte Carlo · Descriptive Statistics

References and Further Reading
Eckhardt, R. (1987). "Stan Ulam, John von Neumann, and the Monte Carlo Method." Los Alamos Science, Special Issue, pp. 131–141. | Boyle, P. P. (1977). "Options: A Monte Carlo approach." Journal of Financial Economics, 4(3), 323–338. | Rubinstein, R. Y. & Kroese, D. P. (2016). Simulation and the Monte Carlo Method (3rd ed.). Wiley. | For related tools: probability calculator, descriptive statistics calculator, Bayes' theorem.