def rescale(old_array, min_, max_):
    """Scale array to vary between min and max."""
    scale_factor = (max_ - min_) / (old_array.max() - old_array.min())
    return min_ + scale_factor * (old_array - old_array.min())