code: public void addValue(double val) {
          numItems++;
          double valMinusMean = val - mean;
          sumsq += valMinusMean * valMinusMean * (numItems - 1) / numItems;
          mean += valMinusMean / numItems;
      }
docs: Update the variance with a new value.
  
  @param val
  a new value.