code: def randomgen_constructor(
      value, name=None, strict=False, allow_downcast=None, borrow=False
  ):
      r"""`SharedVariable` constructor for NumPy's `Generator` and/or `RandomState`."""
      if isinstance(value, np.random.RandomState):
          rng_sv_type = RandomStateSharedVariable
          rng_type = random_state_type
      elif isinstance(value, np.random.Generator):
          rng_sv_type = RandomGeneratorSharedVariable
          rng_type = random_generator_type
  
      if not borrow:
          value = copy.deepcopy(value)
  
      return rng_sv_type(
          type=rng_type,
          value=value,
          strict=strict,
          allow_downcast=allow_downcast,
          name=name,
      )
  
file_path: pytensor/pytensor/tensor/random/var.py
imports: import copy
  import numpy
  from pytensor.compile.sharedvalue import SharedVariable, shared_constructor
  from pytensor.tensor.random.type import random_generator_type, random_state_type
label_desc: Use image node_id 1 for calling a global function with example usage: randomgen_constructor(value, name, strict, allow_downcast, borrow) and returns: rng_sv_type