import random


def random_categorical_values(configs, variable, variations):
    """
    Generate random values for the variable (e.g aspect ratio etc)
    If weights values are not given, the function assign equal weight to all the values
    """
    try:
        weight_values = configs[variable]["weights"]
    except:
        weight_values = [1.0] * len(configs[variable]["range"])

    random_values = random.choices(
        configs[variable]["range"], k=variations, weights=weight_values
    )
    return random_values