import hashlib


def str_to_seed(string: str, bits: int = 32) -> int:
    """
    This functions outputs a consistent seed in the range (0, 2**bits - 1)
    dependent on an input string and the number of `bits`.

    >>> print(str_to_seed(''))
    2018687061
    """
    hash_value = hashlib.sha256(string.encode("utf-8"))
    hash_value = int(hash_value.hexdigest(), 16)
    hash_value = hash_value % 2 ** bits
    return hash_value