Monte Carlo Simulator
Run thousands of random trials to model uncertainty and risk. Simulate probability distributions, custom formulas, and multi-variable scenarios for statistics, finance, operations research, and decision analysis.
Monte Carlo Simulator
Define random variables and run thousands of trials to analyze risk and uncertainty
What a Monte Carlo Simulation Actually Forecasts
Your boss asks “will this project finish by March?” and you give a single date. That date is a guess wearing a suit. A Monte Carlo simulation replaces the guess with thousands of scenarios — each one sampling random values from the ranges you believe are realistic — and hands back a distribution of outcomes instead of a point estimate. Now you can say “there is a 72% chance we finish by March and a 90% chance we finish by mid-April.”
The simulation does not predict the future. It maps uncertainty: given these input ranges, how wide is the set of plausible results? If the spread is narrow, your inputs are well constrained and the decision is straightforward. If the spread is enormous, one or two inputs are dominating the uncertainty and you know exactly where to focus your research.
Choosing Input Distributions for Each Variable
Every uncertain input needs a distribution that describes its plausible range. A uniform distribution says “any value between A and B is equally likely” — useful when you genuinely have no idea where inside the range the truth falls. A triangular distribution adds a most-likely value between the min and max, which better reflects expert judgement. A normal distribution works when you have historical data with a clear average and spread.
The most common mistake: using a normal distribution for something that cannot go negative (like cost or duration) and then getting nonsense samples below zero. A lognormal or triangular distribution avoids negative territory naturally. Another trap is making the range too narrow because it “feels right” — if your optimistic and pessimistic bounds do not actually bracket reality, the simulation output will be overconfident and useless.
Reading the P50 and P90 From Your Results
The histogram of simulation outcomes is your answer, not any single number pulled from it. The P50 (median) is the outcome exceeded by half the runs — a coin-flip confidence level. The P90 is exceeded by only 10% of runs — a conservative planning target. The gap between P50 and P90 tells you how much risk buffer you need if you want high confidence.
Stakeholders often fixate on the mean, but the mean can be pulled by a long tail. If 5% of scenarios produce catastrophic cost overruns, the mean absorbs that tail while the P50 does not. Always present at least P50, P80, and P90 together so the audience sees the shape of risk, not just a single summary statistic. A tornado chart alongside the histogram shows which input variable contributes most to the spread — that is the lever worth investigating further.
How Many Iterations Until the Output Stabilises
Run 100 iterations and your P90 might jump around by 15% each time you re-run. Run 10,000 and the P90 barely moves. Convergence means the percentiles stop shifting as you add more iterations. A practical check: run at 1,000, then at 5,000, then at 10,000. If P50 and P90 change by less than 1–2%, you have enough samples.
More inputs and wider distributions need more iterations because the search space is larger. A model with two triangular inputs converges quickly at 1,000 runs. A model with eight inputs, some lognormal with long tails, may need 50,000 to pin down the P95 reliably. For most business-planning models with three to five inputs, 10,000 iterations is a sensible default — fast enough to run in a browser and stable enough to trust.
Edge Cases That Break a Simulation
Correlated inputs treated as independent. If material cost and labour cost both rise during inflation, sampling them independently understates the probability that both spike at once. The result: the simulation underestimates tail risk. If you suspect correlation, either model the joint distribution or run a sensitivity scenario where both inputs move together.
Zero-width ranges on dominant inputs. Fixing a major cost item at a single value while letting minor items vary makes the simulation look precise. In reality you are hiding the biggest uncertainty behind a constant.
Negative samples from symmetric distributions. A normal distribution centred at $50k with a standard deviation of $30k will produce negative draws about 5% of the time. If negative values are impossible in your domain, truncate the distribution or switch to lognormal.
Core Monte Carlo Equations
The simulation loop and percentile extraction rely on a few straightforward formulas:
Forecasting a Product Launch Budget: Full Example Run
Scenario: You are planning a product launch with three uncertain costs — marketing spend (triangular: $40k/$60k/$90k), vendor fees (uniform: $15k–$25k), and contingency events (lognormal: median $5k, σ = 0.8). You run 10,000 iterations.
Step 1 — Sample each input. In each iteration, draw one value from each distribution independently. Iteration 1 might sample marketing = $55k, vendor = $18k, contingency = $3k. Iteration 2 might sample $72k, $23k, $11k.
Step 2 — Compute total cost. Sum the three samples: iteration 1 total = $76k, iteration 2 = $106k. Repeat 10,000 times and store each total.
Step 3 — Extract percentiles. Sort the 10,000 totals. P50 = $82k, P80 = $97k, P90 = $108k. The tornado chart shows marketing spend drives 60% of the variance, contingency events 30%, vendor fees 10%.
Interpretation: “Budget $82k if you accept a coin-flip chance of overrun. Budget $108k for 90% confidence. If you want to narrow the range, lock down the marketing scope first — it is the biggest swing factor.”
Sources
Investopedia — Monte Carlo Simulation: Overview of Monte Carlo methods for financial forecasting and risk analysis.
PMI — Monte Carlo Simulation for Project Risk: Application of simulation-based risk quantification in project management.
NIST/SEMATECH — Monte Carlo Methods: Statistical foundations of random sampling and convergence in simulation.
Towards Data Science — Monte Carlo Simulation Practical Guide: Implementation walkthrough with distribution selection and convergence checks.
Frequently Asked Questions about Monte Carlo Simulation
What is Monte Carlo simulation in simple terms?
Monte Carlo simulation is a computational technique that uses repeated random sampling to estimate the possible outcomes of processes with uncertainty. Instead of trying to solve everything with formulas, you run thousands or millions of 'trials' where you randomly draw values for uncertain inputs, calculate the result, and summarize the distribution of outcomes. It's named after the Monte Carlo Casino, reflecting its use of randomness and probability.
When should I use Monte Carlo simulation instead of a formula?
Use Monte Carlo when: (1) Analytical formulas are unavailable or too complex (e.g., nonlinear models, custom logic). (2) You have multiple interacting uncertain variables. (3) You want to see the full distribution of outcomes, not just the mean. (4) You're dealing with scenarios where independence assumptions or normal distributions don't hold. Monte Carlo trades exact analytical solutions for flexible, approximate answers that get better with more trials.
How many simulations do I need for good results?
Start with 10,000 trials for preliminary exploration. For smoother, more stable estimates, use 50,000–100,000+ trials. The right number depends on variability: high-variance models need more trials. Check the convergence plot—if the running mean still fluctuates a lot near the end, increase trials. More trials = smaller sampling error, but diminishing returns: doubling trials only reduces error by about 1.4× (√2). For homework and conceptual learning, 10,000–50,000 is usually sufficient.
What is the difference between the simulated mean and the theoretical mean?
The simulated mean is the average of your trial outcomes—an empirical estimate based on random sampling. The theoretical mean (expected value) is the true long-run average if you could run infinite trials. Due to sampling error, the simulated mean differs slightly from the theoretical mean. As the number of trials increases, the law of large numbers ensures the simulated mean converges to the theoretical mean, making it a very good approximation.
What do the percentiles in the results mean?
Percentiles are thresholds below which a certain percentage of simulations fall. For example, the 5th percentile is the value below which 5% of trials lie—a downside risk measure. The 95th percentile is the value below which 95% of trials lie—an upside threshold. The 50th percentile is the median. Percentiles help you understand the range and tails of the distribution: '90% of outcomes fall between the 5th and 95th percentiles' or 'There's a 10% chance the result will be below the 10th percentile.'
Can this simulator predict the future value of a stock or investment?
No. This tool is for educational purposes, not financial advice or predictions. It can model uncertainty in returns based on historical volatility or assumptions, but it cannot predict actual future stock prices or guarantee investment performance. Real markets involve complexities—news, policy changes, behavioral factors—that simple models don't capture. Use Monte Carlo to learn about risk analysis, understand distributions of possible outcomes, and build intuition, not to make actual investment decisions or trading recommendations.
Why do my results change each time I run the simulation?
Results vary slightly because Monte Carlo uses random sampling. Each run generates a different set of random draws, leading to slightly different outcomes (especially with fewer trials). This is normal. To make results reproducible, use the same 'Seed' value—the seed controls the random number sequence, so the same seed gives identical results. For stable estimates, use enough trials that the variation between runs is small. Convergence plots help visualize stability.
How do I choose which distributions to use for my inputs?
Match distributions to the real-world behavior of each variable. Use Normal for symmetric, bell-shaped variability (prices, errors, many natural phenomena). Use Uniform when every value in a range is equally likely (you have minimal information). Use Triangular for expert estimates with a most-likely value and range. Use Lognormal for strictly positive, right-skewed quantities (incomes, project costs). Use Exponential for time-until-event (arrivals, lifetimes). If you have historical data, fit a distribution; if not, use domain knowledge and assumptions. Document your choices clearly.
What does it mean if my outcome distribution is very wide or very narrow?
A wide distribution (high standard deviation, large percentile range) means high uncertainty or risk—outcomes vary a lot. This indicates the system is sensitive to uncertain inputs, so better estimation or risk mitigation may be needed. A narrow distribution (low standard deviation, tight percentiles) means low uncertainty—outcomes are clustered near the mean, indicating predictability. Width depends on input variability and how inputs combine in your model. Sensitivity analysis can identify which inputs drive the most spread.
How should I present Monte Carlo results in homework, presentations, or reports?
Present results as ranges and probabilities, not single-point predictions. Include: (1) Mean and standard deviation. (2) Key percentiles (5th, 25th, 50th, 75th, 95th). (3) Probability of key events (e.g., P(loss), P(exceeding target)). (4) Histograms or charts showing the distribution. (5) Assumptions: which distributions, parameters, number of trials. Express uncertainty: 'Expected profit is $5,000, with 90% confidence between $3,000 and $7,000' instead of 'Profit = $5,000.' This transparency builds credibility and communicates risk clearly.
What is the law of large numbers and how does it relate to Monte Carlo?
The law of large numbers says that as the number of independent trials increases, the sample average converges to the true expected value. In Monte Carlo, this means more simulations give better estimates. With 100 trials, the simulated mean may differ noticeably from the true mean due to sampling error. With 100,000 trials, the simulated mean is very close to the true mean. Convergence plots visually demonstrate this: the running average stabilizes as trials increase. It's the theoretical foundation ensuring Monte Carlo works.
Can I model dependencies or correlations between variables?
Basic Monte Carlo assumes independence between variables (each is sampled separately). If variables are truly correlated (e.g., price and demand often move together), independence can give misleading results. Some tools support correlated sampling (e.g., copulas, multivariate distributions). Alternatively, you can model dependency in your formula (e.g., make demand a function of price). For homework and conceptual learning, independence is often assumed for simplicity, but always state this assumption and recognize the limitation.
What's the difference between Monte Carlo simulation and analytical probability calculations?
Analytical calculations use formulas to compute exact probabilities and expected values (e.g., for a sum of independent normals, you can derive the mean and variance formula). Monte Carlo uses random sampling to approximate these quantities numerically. Analytical methods are exact but limited to tractable models. Monte Carlo is flexible and handles complex models but gives approximate answers that improve with more trials. Use Monte Carlo to verify analytical results, or when analytical solutions are unavailable.
How do I know if my simulation has converged (given enough trials)?
Check the convergence plot: if the running mean stabilizes (stops fluctuating significantly) as trials increase, the simulation has converged. Run the simulation multiple times with different seeds—if results are similar, you have convergence. If they differ a lot, increase trials. A rule of thumb: the standard error of the mean is stdDev / √N, so doubling trials reduces error by ~1.4×. For formal analysis, report confidence intervals. For homework/learning, visual stability in the convergence plot is usually sufficient.
What are the limitations of Monte Carlo simulation I should be aware of?
Monte Carlo limitations: (1) Results depend entirely on your assumptions (distributions, parameters, model structure)—garbage in, garbage out. (2) Requires many trials for accurate estimates—computationally expensive for complex models. (3) Assumes independence unless you explicitly model correlation. (4) Provides empirical approximations, not exact answers. (5) Cannot capture Black Swan events or extreme scenarios not included in your distributions. (6) Does not eliminate uncertainty—it quantifies and communicates it. Always validate assumptions, run sensitivity analyses, and combine Monte Carlo with domain expertise.
Explore More Probability & Risk Analysis Tools
Master Monte Carlo Simulation & Risk Analysis
Build essential skills in probability, uncertainty modeling, and decision-making under risk for statistics, finance, and operations research
Explore All Probability & Statistics Tools