In this paper we present a computation of the mean first-passage times both for a random walk in a discrete bounded lattice, between a starting site and a target site, and for a Brownian motion in a bounded domain, where the target is a sphere. In both cases, we also discuss the case of two targets, including splitting probabilities and conditional mean first-passage times. In addition, we study the higher-order moments and the full distribution of the first-passage time. These results significantly extend our earlier contribution [Condamin, Phys. Rev. Lett. 95, 260601 (2005)].