Distribution of randomly diffusing particles in inhomogeneous media