equalWeights static method

List<double> equalWeights(
  1. int n
)

Generates n equal weights summing to 1.0.

Implementation

static List<double> equalWeights(int n) {
  if (n <= 0) throw ArgumentError('n must be greater than zero.');
  return List.filled(n, 1.0 / n);
}