def _generate_readout_calibration_circuits(
    qubits: list[ops.Qid], rng: np.random.Generator, num_random_bitstrings: int
) -> tuple[list[circuits.Circuit], np.ndarray]:
    """Generates the readout calibration circuits with random bitstrings."""
    bit_to_gate = (ops.I, ops.X)

    random_bitstrings = rng.integers(0, 2, size=(num_random_bitstrings, len(qubits)))

    readout_calibration_circuits = []
    for bitstr in random_bitstrings:
        readout_calibration_circuits.append(
            circuits.Circuit(
                [bit_to_gate[bit](qubit) for bit, qubit in zip(bitstr, qubits)]
                + [ops.M(qubits, key="m")]
            )
        )
    return readout_calibration_circuits, random_bitstrings
Generates the readout calibration circuits with random bitstrings.
cirq-core/cirq/contrib/shuffle_circuits/shuffle_circuits_with_readout_benchmarking.py