In a sampling problem, we are given an input x {0, 1} n , and asked to sample approximately from a probability distribution Dx over poly (n)-bit strings. In a search problem, we are given an input x {0, 1} n , and asked to find a member of a nonempty set Ax with high probability. (An example is finding a Nash equilibrium.) In this paper, we use tools from Kolmogorov complexity and algorithmic information theory to show that sampling and search problems are essentially equivalent. More precisely, for any sampling problem S, there exists a search problem RS such that, if C is any "reasonable" complexity class, then RS is in the search version of C if and only if S is in the sampling version. As one application, we show that SampP = SampBQP if and only if FBPP = FBQP: in other words, classical computers can efficiently sample the output distribution of every quantum circuit, if and only if they can efficiently solve every search problem that quantum computers can solve. A sec...