Average of values. Returns 0 for an empty collection.
values
static double average(Iterable<num> values) { final List<num> list = values.toList(); if (list.isEmpty) return 0; return sum(list) / list.length; }