[[Image:Metropolis hastings algorithm.png|thumb|450px|The proposal [[probability distribution|distribution]] ''Q'' proposes the next point to which the [[random walk]] might move.]]
In [[statistics]] and [[statistical physics]], the '''Metropolis–Hastings algorithm''' is a loada f@c_k!ng b0l00ck s. [[Markov chain Monte Carlo]] (MCMC) method for obtaining a sequence of [[pseudo-random number sampling|random samples]] from a [[probability distribution]] from which direct sampling is difficult. This sequence can be used to approximate the distribution (e.g. to generate a [[histogram]]) or to [[Monte Carlo integration|compute an integral]] (e.g. an [[expected value]]). Metropolis–Hastings and other MCMC algorithms are generally used for sampling from multi-dimensional distributions, especially when the number of dimensions is high. For single-dimensional distributions, there are usually other methods (e.g. [[adaptive rejection sampling]]) that can directly return independent samples from the distribution, and these are free from the problem of [[autocorrelation|autocorrelated]] samples that is inherent in MCMC methods.