inverted score (min = 10, max = 1)
346097
function iScore (min, max, value) {
  value = Math.min(max, value);
  value = Math.max(min, value);
  return round(1 + 9 * (max - value) / (max - min));
}
673781
function score(data, candidate) {
    var result = 0;
    /*
        Scoring calculations here
    */

    //Last Name
    if (!data.name.last || !candidate.name.last) {
        result = result + 0;
    } else if (data.name.last.toUpperCase() === candidate.name.last.toUpperCase()) {
        result = result + 9.58;
    } else if (data.name.last.toUpperCase().substring(0, 3) === candidate.name.last.toUpperCase().substring(0, 3)) {
        result = result + 5.18;
    } else if (data.name.last.toUpperCase().substring(0, 3) !== candidate.name.last.toUpperCase().substring(0, 3)) {
        result = result - 3.62;
    }

    //First Name
    if (!data.name.first || !candidate.name.first) {
        result = result + 0;
    } else if (data.name.first.toUpperCase() === candidate.name.first.toUpperCase()) {
        result = result + 6.69;
    } else if (data.name.first.toUpperCase().substring(0, 3) === candidate.name.first.toUpperCase().substring(0, 3)) {
        result = result + 3.37;
    } else if (data.name.first.toUpperCase().substring(0, 3) !== candidate.name.first.toUpperCase().substring(0, 3)) {
        result = result - 3.27;
    }

    //Middle Initial
    if (!data.name.middle || !candidate.name.middle) {
        result = result + 0;
    } else if (data.name.middle.toUpperCase().substring(0, 1) === candidate.name.middle.toUpperCase().substring(0, 1)) {
        result = result + 3.65;
    }

    //DOB
    if (!data.dob || !candidate.dob) {
        result = result + 0;
    } else if (data.dob.substring(0, 10) === candidate.dob.substring(0, 10)) {
        result = result + 6.22;
    }

    //Initials
    result = result + 0;

    return result;
}
288193
function getRandomInt(min, max) {
    const minInt = Math.ceil(min);
    const maxInt = Math.floor(max);
    return Math.floor(Math.random() * (maxInt - minInt)) + minInt;
}
148579
def min(self):
        
        if len(self._data) == 0:
            return 10
        return next(iter(sorted(self._data.keys())))
616870
private int selectRightToLeft( int col , int[] scores ) {
		// see how far it can search
		int localMax = Math.min(imageWidth-regionWidth,col+maxDisparity)-col-minDisparity;

		int indexBest = 0;
		int indexScore = col;
		int scoreBest = scores[col];
		indexScore += imageWidth+1;

		for( int i = 1; i < localMax; i++ ,indexScore += imageWidth+1) {
			int s = scores[indexScore];

			if( s < scoreBest ) {
				scoreBest = s;
				indexBest = i;
			}
		}

		return indexBest;
	}
949517
def open01(x, limit=1.e-6):
    """"""
    try:
        return np.array([min(max(y, limit), 1. - limit) for y in x])
    except TypeError:
        return min(max(x, limit), 1. - limit)
1147642
@Override protected double[] score0(double[] data, double[] preds, double offset, int ntrees) {
    super.score0(data, preds, offset, ntrees);
    if (ntrees >= 1) preds[1] = preds[0] / ntrees;
    preds[0] = normalizePathLength(preds[0]);
    return preds;
  }
368465
def invert_increasing_function(f, f0, xmin, xmax, tolerance, max_iterations=100):
    

    for n in range(max_iterations):
        # start at the middle
        x = 0.5*(xmin+xmax)

        df = f(x)-f0
        if _n.fabs(df) < tolerance: return x

        # if we're high, set xmin to x etc...
        if df > 0: xmin=x
        else:      xmax=x

    print("Couldn't find value!")
    return 0.5*(xmin+xmax)
575077
function (value, min, max) {
            if (min > max) {
                max = min + max;
                min = max - min;
                max = max - min;
            }
            return Math.min(max, Math.max(min, value));
        }
1188960
function getMinMax() {
  var minPt = pts[0];
  var maxPt = pts[0];
  for (var i=1; i<pts.length; i++) {
    minPt = minPt.$min( pts[i] );
  }
  for (i=1; i<pts.length; i++) {
    maxPt = maxPt.$max( pts[i] );
  }
  nextRect.set( minPt).to( maxPt );
}
98803
function ttone1 (reps, row, key, beat, amp) {
  var tr = row.split(' ').map(function (n) {
    return +n + key
  })
  var r = score.repeat(reps, score.phrase(tr, beat, amp))
  return score.map(function (e) {
    return randDur(randOct(e), beat)
  }, null, r)
}
29681
function daleChallGradeLevel(score) {
  score = Math.floor(score)

  if (score < 5) {
    score = 4
  } else if (score > 9) {
    score = 10
  }

  return gradeMap[score].concat()
}
350710
function select(ids, coords, k, left, right, axis) {

    while (right > left) {
        if (right - left > 600) {
            const n = right - left + 1;
            const m = k - left + 1;
            const z = Math.log(n);
            const s = 0.5 * Math.exp(2 * z / 3);
            const sd = 0.5 * Math.sqrt(z * s * (n - s) / n) * (m - n / 2 < 0 ? -1 : 1);
            const newLeft = Math.max(left, Math.floor(k - m * s / n + sd));
            const newRight = Math.min(right, Math.floor(k + (n - m) * s / n + sd));
            select(ids, coords, k, newLeft, newRight, axis);
        }

        const t = coords[2 * k + axis];
        let i = left;
        let j = right;

        swapItem(ids, coords, left, k);
        if (coords[2 * right + axis] > t) swapItem(ids, coords, left, right);

        while (i < j) {
            swapItem(ids, coords, i, j);
            i++;
            j--;
            while (coords[2 * i + axis] < t) i++;
            while (coords[2 * j + axis] > t) j--;
        }

        if (coords[2 * left + axis] === t) swapItem(ids, coords, left, j);
        else {
            j++;
            swapItem(ids, coords, j, right);
        }

        if (j <= k) left = j + 1;
        if (k <= j) right = j - 1;
    }
}
286932
private void fixdownMaxWithComparator(int k) {
        int c = 2 * k;
        while (c <= size) {
            int m = maxChildOrGrandchildWithComparator(k);
            if (m > c + 1) { // grandchild
                if (comparator.compare(array[m], array[k]) <= 0) {
                    break;
                }
                K tmp = array[k];
                array[k] = array[m];
                array[m] = tmp;
                if (comparator.compare(array[m], array[m / 2]) < 0) {
                    tmp = array[m];
                    array[m] = array[m / 2];
                    array[m / 2] = tmp;
                }
                // go down
                k = m;
                c = 2 * k;
            } else { // child
                if (comparator.compare(array[m], array[k]) > 0) {
                    K tmp = array[k];
                    array[k] = array[m];
                    array[m] = tmp;
                }
                break;
            }
        }
    }
1213400
@Override protected double[] score0(double data[/*ncols*/], double preds[/*nclasses+1*/], double offset, int ntrees) {
    super.score0(data, preds, offset, ntrees);    // These are f_k(x) in Algorithm 10.4
    return score0Probabilities(preds, offset);
  }
1153559
def standardize(score):
    """"""
    score = asarray_ndim(score, 1)
    return (score - np.nanmean(score)) / np.nanstd(score)
331771
function evaluate(score, at, mt) {
    var automaticThreshold = at || 17.73;
    var manualThreshold = mt || 15.957;

    var result = "no match";

    if (score >= automaticThreshold) {
        result = "automatic";
    } else if (score >= manualThreshold) {
        result = "manual";
    }

    return result;
}