It would be good to mention this returns 0 if it doesn't have enough information to sample.