Probability distribution of inherent states in models of granular media and glasses