def scale_to_unit_interval(ndar, eps=1e-8):
    """
    Scales all values in the ndarray 'ndar' to be between 0 and 1.

    Parameters
    ----------
    ndar : numpy.ndarray
        The input array to scale values.
    eps : float
        Small value to avoid divide-by-zero when scaling.

    Returns
    -------
    numpy.ndarray
        The input array scaled to be between 0 and 1.
    """
    ndar = ndar.copy()
    ndar -= ndar.min()
    ndar *= 1.0 / (ndar.max() + eps)
    return ndar