docs: public static void normalize(double[] a) {
      double total = sum(a);
      if (total == 0.0 || Double.isNaN(total)) {
        throw new RuntimeException("Can't normalize an array with sum 0.0 or NaN: " + Arrays.toString(a));
      }
      multiplyInPlace(a, 1.0/total); // divide each value by total
    }