code: def set_random_labels(samples, N):
      random_cnt = 0
      for sample in samples:
          text = sample["text"]
          change_label = (
              hashlib.md5(text.encode("utf8")).digest()[0] < N * 256
          )
          # deterministic flipping for each example
          if change_label:
              random_cnt += 1
          if random.random() > 0.5:
              sample["labels"] = ["__ok__"]
          else:
              sample["labels"] = ["__notok__"]
      logging.debug(f"{random_cnt} labels randomized.")
      return samples
  
file_path: ParlAI/parlai/tasks/safety_mix/build.py
imports: import copy
  import hashlib
  import json
  import os
  import random
  import numpy
  import parlai.core.build_data
  import parlai.utils.logging
  from parlai.core.build_data import DownloadableFile
label_desc: Use image node_id 7 for calling a global function with example usage: set_random_labels(samples, N) and returns: samples