"""Random seed management for reproducibility.

This module provides utilities for setting random seeds across all random
number generators used in the codebase (Python, NumPy, PyTorch).
"""

import os
import random
import numpy as np
import torch


def set_seed(seed: int) -> None:
    """Set random seeds for all random number generators.

    Sets seeds for Python's random module, NumPy, PyTorch (CPU and CUDA),
    and the Python hash seed to ensure reproducibility across runs.

    Args:
        seed: Integer seed value to use for all generators.
    """
    random.seed(seed)
    np.random.seed(seed)
    torch.manual_seed(seed)
    torch.cuda.manual_seed_all(seed)
    os.environ["PYTHONHASHSEED"] = str(seed)
