Created
August 3, 2019 17:57
-
-
Save cuckookernel/5fc445585c469644b1fcd51488b08d28 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Array where Element == Double { | |
func mean() -> Double { | |
if self.count == 0 { return Double.nan } | |
var ret = 0.0 | |
for x in ret { | |
ret += x | |
} | |
return ret / self.count | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment