code: def random_sample_from_nn_domain(
      nn_type,
      num_samples,
      sample_type="rand",
      nn_constraint_checker=None,
  ):
      """Randomly samples num_samples neural networks."""
      initial_nns = get_initial_pool(nn_type)
      np.random.shuffle(initial_nns)
      if sample_type == "ff_only":
          if num_samples <= len(initial_nns):
              return initial_nns[:num_samples]
          else:
              num_add_nns = num_samples - len(initial_nns)
              additional_nns = np.random.choice(
                  initial_nns, size=num_add_nns, replace=True
              )
              return initial_nns + additional_nns
      elif sample_type == "rand":
          ret = nn_examples.generate_many_neural_networks(
              nn_type, num_samples, initial_nns, nn_constraint_checker
          )
          if len(ret) < num_samples:
              additional_nns = np.random.choice(
                  ret, size=num_samples - len(ret), replace=True
              )
              ret += additional_nns
          np.random.shuffle(ret)
          return ret
      else:
          raise ValueError("Unknown sample type %s." % (sample_type))
  
file_path: dragonfly/dragonfly/nn/nn_opt_utils.py
imports: import numpy
  from .None import nn_examples
  from ..exd.experiment_caller import FunctionCaller
label_desc: Use image node_id 4 for calling a global function with example usage: random_sample_from_nn_domain(nn_type, num_samples, sample_type, nn_constraint_checker) and returns: initial_nns, unknown, ret