def METHOD_NAME(self, data: CreateRandomEntry):
    """
    create_random_meal is a route that provides the randomized functionality for mealplaners.
    It operates by following the rules setout in the Groups mealplan settings. If not settings
    are set, it will default return any random meal.
    Refer to the mealplan settings routes for more information on how rules can be applied
    to the random meal selector.
    """
    # Get relevant group rules
    rules = self.repos.group_meal_plan_rules.by_group(self.group_id).get_rules(
        PlanRulesDay.from_date(data.date), data.entry_type.value
    )
    recipe_repo = self.repos.recipes.by_group(self.group_id)
    random_recipes: list[Recipe] = []
    if not rules:  # If no rules are set, return any random recipe from the group
        random_recipes = recipe_repo.get_random()
    else:  # otherwise construct a query based on the rules
        tags = []
        categories = []
        for rule in rules:
            if rule.tags:
                tags.extend(rule.tags)
            if rule.categories:
                categories.extend(rule.categories)
        if tags or categories:
            random_recipes = self.repos.recipes.by_group(self.group_id).get_random_by_categories_and_tags(
                categories, tags
            )
        else:
            random_recipes = recipe_repo.get_random()
    try:
        recipe = random_recipes[0]
        return self.mixins.create_one(
            SavePlanEntry(
                date=data.date,
                entry_type=data.entry_type,
                recipe_id=recipe.id,
                group_id=self.group_id,
                user_id=self.user.id,
            )
        )
    except IndexError as e:
        raise HTTPException(
            status_code=404, detail=ErrorResponse.respond(message=self.t("mealplan.no-recipes-match-your-rules"))
        ) from e