def _gen_random_array(n):
 randArray = [random.random() for i in range(n)]
 total = sum(randArray)
 normalizedRandArray = [(x / total) for x in randArray]
 return normalizedRandArray

def _gen_random_array ( n ) : randArray = [ random . random ( ) for i in range ( n ) ] total = sum ( randArray ) normalizedRandArray = [ ( x / total ) for x in randArray ] return normalizedRandArray
return an array of n random numbers .