import torch


def branched(probs, alpha):
    """Branch from probability dist to random with prob 1-alpha."""
    probs = torch.mul(probs, alpha)

    # Add to random
    random = torch.mul(torch.ones(probs.shape[0]), 1/probs.shape[0])
    probs = torch.add(probs, torch.mul(random, (1-alpha)))

    return probs