Exact distributions of random motions in inhomogeneous media