We propose a randomized method for general convex optimization problems; namely, the minimization of a linear function over a convex body. The idea is to generate N random points inside the body, choose the best one and cut the part of the body defined by the linear constraint. We first analyze the convergence properties of the algorithm from a theoretical viewpoint, i.e., under a rather classical assumption that an algorithm for uniform generation of random points in the convex body is available. Under this assumption, the expected rate of convergence for such method is proved to be geometric. Moreover, explicit sample size results on convergence are derived. In particular, we compute the minimum number of random points that should be generated at each step in order to guarantee that, in a probabilistic sense, the method converges at least as fast as the deterministic center-of-gravity algorithm. From a practical viewpoint, the method can be implemented using Hit-and-Run versions of Markov-chain Monte Carlo algorithms, and we show how these convergence results can be extended to a Hit-and-Run implementation. A crucial notion for the Hit-and-Run implementation is that of Boundary Oracle, which is available for most optimization problems including LMIs and many other kinds of constraints. Preliminary numerical results for SDP problems are presented confirming that the randomized approach might be competitive to modern deterministic convex optimization methods.