Handle integer weights in discrete_distribution.  FIxes #6022.