helpers library

Collections of helpful functions to write easier code.

Functions

argMax<T extends num>(List<T> list) int
Returns the index of the largest element in the list
mean(List<num> a, [double defaultValue = 0]) double
variance(List<num> a, [double defaultValue = 0]) double
weightedRandom(List<double> weights, Random random) int
Returns a number between [0, weights.length) with probability proportional to the weights