# Monte Carlo Algorithm

## Definition - What does Monte Carlo Algorithm mean?

A Monte Carlo algorithm is a type of resource-restricted algorithm that returns answers based on probability. As a result, the solutions produced by the Monte Carlo algorithm may or may not be correct within a certain margin of error. Mathematicians, scientists and developers use Monte Carlo algorithms to make observations based on input.

## Techopedia explains Monte Carlo Algorithm

One of the best ways to describe Monte Carlo algorithms is to contrast them with a different class of algorithms called Las Vegas algorithms. In a Las Vegas algorithm, the result will always be correct, but the system may use more than the anticipated amount of resources or time. In the words of some experts, the Las Vegas algorithm “gambles” with resource usage while always returning a precise result.

On the contrary, the Monte Carlo algorithm uses a finite resource path to generate the above-mentioned “fuzzy” results with a margin of error. Monte Carlo algorithms often rely on repeated random sampling – they get general random numbers, and look for probability in order to provide results.

Some experts use the example of a square within a circle, and describe the process of the Monte Carlo algorithm as a series of “hits” that will land either in the interior circle, or in the outer edges of the square beyond the circle’s boundaries. Visual demonstrations show how more repeated sampling gives the Monte Carlo algorithm a more precise result. Monte Carlo algorithms, as well as things like a Monte Carlo tree search or Monte Carlo simulator, rely on this foundational mathematical idea that repeated sampling yields logical intelligence results.