distribute counts given a desired distribution (with smart rounding)

distribute_counts(total, dist)

Arguments

total

total count to distribute

dist

target distribution (a vector that sums to 1)