from typing import List
from typing import Tuple


def generateThresh(b: int, e: float, dist: str) -> List[Tuple[float, float]]:
    """Generates a threshold map

    Args:
        b (int): bits per cell
        e (float): std dev between levels
        dist (str): threshold distribution (uniform or split-*)

    Raises:
        ValueError: if dist is not uniform or split-*

    Returns:
        list: threshold map
    """
    if dist == "uniform":
        temp: List[Tuple[float, float]] = []
        for i in range(2 ** (b)):
            temp.append((float(i) / (2 ** (b) - 1), e))
        return temp
    elif dist[:5] == "split":
        if "-" in dist:
            center = float(dist.split("-")[1])
        else:
            center = e

        temp = []
        for i in range(2 ** (b - 1)):
            temp.append((i / (2 ** (b) + center / 2 - 1), e))

        for i in reversed(range(len(temp))):
            temp.append((1 - temp[i][0], e))
        return temp
    else:
        raise ValueError(f"Unknown threshold distribution: {dist}")