--[[ @brief Proportionally modifies all numbers in an array so the sum is 1.
     @example Normalize({1, 2, 3}) = {1/6, 2/6, 3/6};
     @param t The array to normalize.
     @return t The normalized array. This will be the same as t.
--]]

function module.Normalize(t)
	local sum = module.Sum(t);
	if sum~=0 then
		for i, v in pairs(t) do
			t[i] = v/sum;
		end
	end
	return t;
end
