def _pauli_basis_rotation(rng: np.random.Generator) -> cirq.Gate:
    """Randomly generate a Pauli basis rotation.

    Args:
        rng: Random number generator

    Returns:
        cirq gate
    """
    basis_idx = rng.choice(np.arange(3))

    if basis_idx == 0:
        gate: cirq.Gate = cirq.Ry(rads=-np.pi / 2)
    elif basis_idx == 1:
        gate = cirq.Rx(rads=np.pi / 2)
    else:
        gate = cirq.I
    return gate
Randomly generate a Pauli basis rotation.

    Args:
        rng: Random number generator

    Returns:
        cirq gate
    
cirq-core/cirq/transformers/randomized_measurements.py