aboutsummaryrefslogtreecommitdiff
path: root/utils.go
diff options
context:
space:
mode:
Diffstat (limited to 'utils.go')
-rw-r--r--utils.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/utils.go b/utils.go
index a14fdca..ec5a807 100644
--- a/utils.go
+++ b/utils.go
@@ -151,3 +151,11 @@ func ParseIPNet(address string) *net.IPNet {
return network
}
+
+func Average(array []float64) float64 {
+ var sum float64
+ for _, f := range array {
+ sum += f
+ }
+ return sum / float64(len(array))
+}