FunkPanion/scripts/MathUtils.gd

10 lines
204 B
GDScript3
Raw Normal View History

2024-11-23 20:36:52 +00:00
class_name MathUtils
static func average(numbers: Array) -> float:
var sum = 0.0
var size = numbers.size() - 1
for n in size:
var diff = numbers[n + 1] - numbers[n]
sum += diff
return sum / size