Monte Carlo simulation has many applications such as risk analysis and engineering design. It's often the best method to deal with uncertainty in complex models where an analytical solution would be nearly impossible. The graphic below provides a Monte Carlo simulation overview.
The first step is to identify the uncertain inputs, or random variables. This could be things like revenues, costs, project task times, design conditions, etc. Once we've identified the random variables, we need to describe them with a probability distribution.
Once the random variables are defined, we need to create a model. The model describes the relationship between the input variables and the output that we want to calculate. A simple example is a model for profit. Our inputs are revenue and expenses. The output is profit.
Profit = Revenue - Expenses
Now we're ready to simulate the model. When a simulation is run, the simulation process is iterated (repeated) many times, often thousands of times. During each iteration, every random variable is sampled. Sampling means we are generating a value for each random variable to plug into the model. A sample is generated by drawing a random number between 0 and 1. That random number is used as a probability in the random variable's cumulative distribution function, and the value is then determined.
After each random variable value is plugged into the model, the output is calculated and recorded. The sampling and calculation process is then repeated over and over again.
Once the simulation has been run we have model output data showing the range of possible values. This data can be placed in a histogram to analyze the probability of output values and well as summary statistics. We can also look at how input variables correlate with output. Running the simulation and analyzing the output is where Monte Carlo simulation software greatly assists in making the simulation as painless as possible.