def METHOD_NAME(pool):
    num_samples = len(pool)
    if num_samples == 1:
        # only one sample: it is impossible to generate negative sample
        yield pool[0]._replace(label=1)
        return
    self.global_rng.shuffle(pool)
    for i in range(num_samples):
        pool[i] = pool[i]._replace(label=1)
        j = (i + 1) % num_samples
        idx_i = pool[i].tgt_start_idx
        idx_j = pool[j].tgt_start_idx
        field_values = {}
        field_values["token_ids"] = pool[i].token_ids[:idx_i] + pool[j].token_ids[idx_j:]
        field_values["type_ids"] = pool[i].type_ids[:idx_i] + pool[j].type_ids[idx_j:]
        field_values["pos_ids"] = list(range(len(field_values["token_ids"])))
        neg_record = self.Record(**field_values, tgt_start_idx=idx_i, data_id=-1, label=0)
        pool.append(neg_record)
        assert len(neg_record.token_ids) <= self.max_seq_len
    self.global_rng.shuffle(pool)
    for record in pool:
        yield record