code: def test_GeneratorSharedVariable(rng):
      s_rng_default = shared(rng)
      s_rng_True = shared(rng, borrow=True)
      s_rng_False = shared(rng, borrow=False)
  
      # test borrow contract: that False means a copy must have been made
      assert s_rng_default.container.storage[0] is not rng
      assert s_rng_False.container.storage[0] is not rng
  
      # test current implementation: that True means a copy was not made
      assert s_rng_True.container.storage[0] is rng
  
      # ensure that all the random number generators are in the same state
      if hasattr(rng, "randn"):
          v = rng.randn()
          v0 = s_rng_default.container.storage[0].randn()
          v1 = s_rng_False.container.storage[0].randn()
      else:
          v = rng.standard_normal()
          v0 = s_rng_default.container.storage[0].standard_normal()
          v1 = s_rng_False.container.storage[0].standard_normal()
  
      assert v == v0 == v1
  
imports: import numpy
  import pytest
  from pytensor import shared
label_desc: Use image node_id 1 for calling a global function with example usage: test_GeneratorSharedVariable(rng) without return types