import random


def _rand_range(start: int, end: int, seed: int | None = None):
    """Generates a random number in a range with an optional seed value.

    Args:
        start: The starting value
        end: THe ending value
        seed: Optional seed

    Returns:
        A random integer between start and end.
    """
    if seed:
        random.seed(seed)
    return random.randrange(start, end)