code: def random_gen(
      shape,
      rand_min=0.0,
      rand_max=1.0,
      eps_from_int=0.0,
      allow_duplicate=True,
      dtype=np.float32,
  ):
      """
      This helper function generates a random array of shape `shape`
      The range of generated numbers will be between (rand_min, rand_max].
      The value of generated numbers will be at least `eps_from_int` apart from integers.
      If allow_duplicate is set to false, it is guaranteed that value generated are all different.
      Default data type is np.float32.
      """
      elem = np.prod(shape).astype(np.int)
      ret = []
      for _ in range(elem):
          while True:
              r = dtype(
                  (rand_max - rand_min) * np.random.random() + rand_min
              )
              if not allow_duplicate and r in ret:
                  continue
              if np.fabs(np.round(r) - r) > eps_from_int:
                  ret.append(r)
                  break
      ret = np.array(ret).reshape(shape)
      return ret.astype(dtype)
  
imports: import logging
  import numpy
  import copy
  import coremltools
  from coremltools import converters
  from coremltools.converters.mil import converter
  from coremltools.converters.mil.mil import Program, Function
  from coremltools.converters.mil.mil.passes.pass_registry import PASS_REGISTRY
  from coremltools._deps import _IS_MACOS
label_desc: Use image node_id 6 for calling a global function with example usage: random_gen(shape, rand_min, rand_max, eps_from_int, allow_duplicate, dtype) and returns: ret