code: def _rand_with_constraints(x_bounds, x_types):
      """
      Random generate with constraints
      """
      outputs = None
  
      x_bounds_withconstraints = [
          x_bounds[i] for i in CONSTRAINT_PARAMS_IDX
      ]
      x_types_withconstraints = [
          x_types[i] for i in CONSTRAINT_PARAMS_IDX
      ]
      x_val_withconstraints = lib_constraint_summation.rand(
          x_bounds_withconstraints,
          x_types_withconstraints,
          CONSTRAINT_LOWERBOUND,
          CONSTRAINT_UPPERBOUND,
      )
      if x_val_withconstraints is not None:
          outputs = [None] * len(x_bounds)
  
          for i, _ in enumerate(CONSTRAINT_PARAMS_IDX):
              outputs[CONSTRAINT_PARAMS_IDX[i]] = x_val_withconstraints[
                  i
              ]
  
          for i, _ in enumerate(outputs):
              if outputs[i] is None:
                  outputs[i] = random.randint(
                      x_bounds[i][0], x_bounds[i][1]
                  )
      return outputs
  
file_path: nni/nni/algorithms/hpo/metis_tuner/Regression_GP/Selection.py
imports: import os
  import random
  import sys
  from ..None import lib_acquisition_function
  from ..None import lib_constraint_summation
  from ..None import lib_data
  from .None import Prediction
label_desc: Use image node_id 3 for calling a global function with example usage: _rand_with_constraints(x_bounds, x_types) and returns: outputs