INNER CODE UNIT · Go

StdDevTimeDuration

deepfence/FlowMeter · pkg/common/common.go:47

func StdDevTimeDuration(array []time.Duration) time.Duration {

	square := float64(0)

	for j := 1; j < len(array); j++ {
		square += float64((array[j]-MeanTimeDuration(array))/time.Microsecond) * float64((array[j]-MeanTimeDuration(array))/time.Microsecond)
	}

	return time.Duration(math.Sqrt(square/float64(len(array)))) * time.Microsecond
}

// Min or max function (int datatype.)
func MinMax(array []int) (int, int) {
	if len(array) == 0 {
		return 0, 0
	} else {
		var max int = array[0]
		var min int = array[0]

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…