code: def random_of_dtype(shape, dtype, rng=None):
      if dtype in discrete_dtypes:
          return integers(*shape, rng=rng).astype(dtype)
      elif dtype in float_dtypes:
          return random(*shape, rng=rng).astype(dtype)
      elif dtype in complex_dtypes:
          return random_complex(*shape, rng=rng).astype(dtype)
      else:
          raise TypeError()
  
imports: import os
  from copy import copy
  from itertools import combinations
  from tempfile import mkstemp
  import numpy
  import pytest
  import pytensor
  from pytensor import function, shared
  from pytensor.compile.mode import get_default_mode
  from pytensor.configdefaults import config
  from pytensor.graph.utils import MethodNotDefined
  from pytensor.misc.safe_asarray import _asarray
  from pytensor.tensor.type import TensorType, complex_dtypes, discrete_dtypes, float_dtypes
  from tests import unittest_tools
label_desc: Use image node_id 20 for calling a global function with example usage: random_of_dtype(shape, dtype, rng) and returns: integers, random, random_complex