code: def random_archi_generator(nas_ss, random_state):
      """random"""
      chosen_arch = {}
      for key, val in nas_ss.items():
          assert val["_type"] in [
              "layer_choice",
              "input_choice",
          ], "Random NAS Tuner only receives NAS search space whose _type is 'layer_choice' or 'input_choice'"
          if val["_type"] == "layer_choice":
              choices = val["_value"]
              index = random_state.randint(len(choices))
              chosen_arch[key] = {
                  "_value": choices[index],
                  "_idx": index,
              }
          elif val["_type"] == "input_choice":
              choices = val["_value"]["candidates"]
              n_chosen = val["_value"]["n_chosen"]
              chosen = []
              idxs = []
              for _ in range(n_chosen):
                  index = random_state.randint(len(choices))
                  chosen.append(choices[index])
                  idxs.append(index)
              chosen_arch[key] = {"_value": chosen, "_idx": idxs}
          else:
              raise ValueError(
                  "Unknown key %s and value %s" % (key, val)
              )
      return chosen_arch
  
file_path: nni/examples/tuners/random_nas_tuner/random_nas_tuner.py
imports: import numpy
  from nni.tuner import Tuner
label_desc: Use image node_id 1 for calling a global function with example usage: random_archi_generator(nas_ss, random_state) and returns: chosen_arch