There is a set of characters that needs to be uniformly distributed in an array. For example,
a - 1
b - 2
c - 3
d - 4
In this case there
You could use something similar to the bresenham algorithm to track the error between the ideal spacing and the last spacing for each component:
vals = ['a','b','c','d']
cts = [1,2,3,4]
sz = sum(cts)
spacing = [float(sz)/(ct+1) for ct in cts]
err = [s for s in spacing]
a=[]
for i in range(sz):
err = [e-1 for e in err]
m = min(err)
i = err.index(m)
a.append(vals[i])
err[i]+=spacing[i]
print a
yeilds: ['d', 'c', 'b', 'd', 'a', 'c', 'd', 'b', 'c', 'd']