Prevent infinite loop in binomial_distribution.  Fixes #9652.