def random_tournament(n):
    r"""Returns a random tournament graph on `n` nodes.

    Parameters
    ----------
    n : int
        The number of nodes in the returned graph.

    Returns
    -------
    bool
        Whether the given graph is a tournament graph.

    Notes
    -----
    This algorithm adds, for each pair of distinct nodes, an edge with
    uniformly random orientation. In other words, `\binom{n}{2}` flips
    of an unbiased coin decide the orientations of the edges in the
    graph.

    """
    # Flip an unbiased coin for each pair of distinct nodes.
    coins = (random.random() for i in range((n * (n - 1)) // 2))
    pairs = combinations(range(n), 2)
    edges = ((u, v) if 0.5 < r else (v, u) for (u, v), r in zip(pairs, coins))
    return nx.DiGraph(edges)
dataset/ETHPy150Open networkx/networkx/networkx/algorithms/tournament.py/random_tournament/swapped operands of `<`