Skip to content

Instantly share code, notes, and snippets.

@matteo-grella
Created March 28, 2018 21:25
Show Gist options
  • Save matteo-grella/431a1b958ae119784792d39d77cb6d58 to your computer and use it in GitHub Desktop.
Save matteo-grella/431a1b958ae119784792d39d77cb6d58 to your computer and use it in GitHub Desktop.
Simple Method to Calculate the Incremental Average
fun incrementalAverage(previousAverage: Double, value: Double, iterationIndex: Int): Double {
return (value - previousAverage) / (iterationIndex + 1) + previousAverage
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment