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.int32)
  
      # Since this function is extensively used as well for the fp16 precision models,
      # we make sure that the numerical value can be presented in fp16.
      gen_dtype = np.float16 if dtype == np.float32 else dtype
      ret = []
      for _ in range(elem):
          while True:
              r = gen_dtype(
                  (rand_max - rand_min) * np.random.random() + rand_min
              )
              if not allow_duplicate and r in ret:
                  continue
              if (
                  np.issubdtype(gen_dtype, np.integer)
                  or 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 itertools
  import copy
  import os
  from functools import partial
  from pathlib import Path
  from typing import Dict, List, Tuple
  import numpy
  import pytest
  from PIL import Image
  import coremltools
  import coremltools.models.utils
  from coremltools._deps import _IS_MACOS
  from coremltools.converters.mil.mil import Block, Function, Program
  from coremltools.converters.mil.mil.passes.defs.preprocess import NameSanitizer
  from coremltools.converters.mil.mil.passes.defs.quantization import AbstractQuantizationPass
  from coremltools.converters.mil.mil.passes.pass_registry import PASS_REGISTRY
  from coremltools.proto import FeatureTypes_pb2
label_desc: Use image node_id 14 for calling a global function with example usage: random_gen(shape, rand_min, rand_max, eps_from_int, allow_duplicate, dtype) and returns: ret