public final double sampleSigma ( int n ) { synchronized ( _lock ) { long count = _count . get ( ) ; long lastCount = _lastStdCount ; _lastStdCount = 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