minor robustness in sample_discrete