use average instead of median, add safety check for average==0

This commit is contained in:
Jonathan Shook
2022-12-07 14:33:46 -06:00
parent 15f15ebc90
commit a1fbb6dcca

View File

@@ -52,7 +52,7 @@ public class TriangularStepFunction implements LongUnaryOperator {
TriangularStepFunction(long average, long variance) {
if (average<=0 || variance < 0 || variance > average) {
throw new RuntimeException(
"The average must be non-negative, and the variance must be less than the average. " +
"The average must be positive, variance non-negative and the variance must be less than the average. " +
"You provided average=" + average + ", variance=" + variance + "."
);
}