median property

num median

Returns the sample median (second quartile).

Implementation

num get median {
  final q2 = sample.length ~/ 2;
  return (sample.length.isEven)
      ? (sortedSample()[q2 - 1] + sortedSample()[q2]) / 2
      : sortedSample()[q2];
}