def Distribution(pos, size, counts, dtype):
 x = numpy.zeros(size, dtype=dtype)
 if hasattr(pos, '__iter__'):
  total = 0
  for i in pos:
   total += counts[i]
  total = float(total)
  for i in pos:
   x[i] = (counts[i] / total)
 else:
  x[pos] = 1
 return x

def Distribution ( pos , size , counts , dtype ) : x = numpy . zeros ( size , dtype = dtype ) if hasattr ( pos , '__iter__' ) : total = 0 for i in pos : total += counts [ i ] total = float ( total ) for i in pos : x [ i ] = ( counts [ i ] / total ) else : x [ pos ] = 1 return x
returns an array of length size and type dtype that is everywhere 0 .