@staticmethod
    def flip_n_bits(n, msg):
        out = []
        for byte in msg:
            bits = list(range(8))
            for _ in range(n):
                bit = bits.pop(random.randint(0, len(bits) - 1))
                byte = byte ^ 1 << bit
            out.append(byte)
        return out
dataset/ETHPy150Open richo/groundstation/test/test_ue_encoder.py/TestUnambiguousEncapsulation.flip_n_bits/original