import random


def best_index(seq):
    """best_index(seq)
    Given a sequence, find the postion of the largest value.
    Ties are broken randomly.
    """
    largest = max(seq)
    indices = []
    for idx, val in enumerate(seq):
        if val == largest:
            indices.append(idx)

    # Randomize if necessary
    if len(indices) > 1:
        random.shuffle(indices)

    return indices[0]