Explore Library
Code QuizAdvanced

A/B Traffic Split Between Models

Spot the bug in a function that routes traffic 80/20 between two models.

Codepython
import random

def route_request(user_id):
    # Send 80% of traffic to model A, 20% to model B
    if random.random() < 0.8:
        return "model_B"
    return "model_A"

What is the bug in this traffic-splitting function?