probabilityForRange method Null safety

double probabilityForRange(
  1. double min,
  2. double max
)

Calculates probability that the value is in the range.

Implementation

double probabilityForRange(double min, double max) {
  if (min.isNaN) {
    throw ArgumentError.value(min, 'min');
  }
  if (max.isNaN) {
    throw ArgumentError.value(min, 'min');
  }
  if (max < min) {
    throw ArgumentError.value(max, 'max', 'Must be >= min');
  }
  return cdf(max) - cdf(min);
}