public final double sampleSigma(int n){
synchronized (_lock) {
    long count=_totalCount.get();
    long lastCount=_lastStdTotalCount;
    _lastStdTotalCount=count;
    double sum=_sum.get();
    double lastSum=_lastStdSum;
    _lastStdSum=sum;
    double sumSquare=_sumSquare;
    _sumSquare=0;
    if (count == lastCount)     return 0;
    double avg=(sum - lastSum) / (count - lastCount);
    double part=(count - lastCount) * sumSquare - sum * sum;
    if (part < 0)     part=0;
    double std=Math.sqrt(part) / (count - lastCount);
    return _scale * (avg + n * std);
  }
}

public final double sampleSigma ( int n ) { synchronized ( _lock ) { long count = _totalCount . get ( ) ; long lastCount = _lastStdTotalCount ; _lastStdTotalCount = count ; double sum = _sum . get ( ) ; double lastSum = _lastStdSum ; _lastStdSum = sum ; double sumSquare = _sumSquare ; _sumSquare = 0 ; if ( count == lastCount ) return 0 ; double avg = ( sum - lastSum ) / ( count - lastCount ) ; double part = ( count - lastCount ) * sumSquare - sum * sum ; if ( part < 0 ) part = 0 ; double std = Math . sqrt ( part ) / ( count - lastCount ) ; return _scale * ( avg + n * std ) ; } }
return the probe ' s next 2 - sigma
