def check_sample(n_samples: int, sample: int) -> bool:
    """
    Check sample is between 0 <= from_sample < n_samples

    Parameters
    ----------
    n_samples : int
        Number of samples
    sample : int
        Sample to check

    Returns
    -------
    bool
        Return True if no errors

    Raises
    ------
    ValueError
        If sample < 0
    ValueError
        If sample > n_samples

    Examples
    --------
    >>> from resistics.sampling import check_sample
    >>> check_sample(100, 45)
    True
    >>> check_sample(100, 100)
    Traceback (most recent call last):
    ...
    ValueError: Sample 100 must be < 100
    >>> check_sample(100, -1)
    Traceback (most recent call last):
    ...
    ValueError: Sample -1 must be >= 0
    """
    if sample < 0:
        raise ValueError(f"Sample {sample} must be >= 0")
    if sample >= n_samples:
        raise ValueError(f"Sample {sample} must be < {n_samples}")
    return True