code: def test_seed(self, rng_ctor):
      init_seed = 234
      random = RandomStream(init_seed, rng_ctor=rng_ctor)
  
      assert random.default_instance_seed == init_seed
  
      new_seed = 43298
      random.seed(new_seed)
  
      rng_seed = np.random.SeedSequence(new_seed)
      assert random.gen_seedgen.entropy == rng_seed.entropy
  
      random.seed()
  
      rng_seed = np.random.SeedSequence(init_seed)
      assert random.gen_seedgen.entropy == rng_seed.entropy
  
      # Reset the seed
      random.seed(new_seed)
  
      # Check state updates
      _ = random.normal()
  
      # Now, change the seed when there are state updates
      random.seed(new_seed)
  
      update_seed = np.random.SeedSequence(new_seed)
      (update_seed,) = update_seed.spawn(1)
      ref_rng = random.rng_ctor(update_seed)
      state_rng = random.state_updates[0][0].get_value(borrow=True)
  
      if hasattr(state_rng, "get_state"):
          ref_state = ref_rng.get_state()
          random_state = state_rng.get_state()
          assert np.array_equal(random_state[1], ref_state[1])
          assert random_state[0] == ref_state[0]
          assert random_state[2:] == ref_state[2:]
      else:
          ref_state = ref_rng.__getstate__()
          random_state = state_rng.__getstate__()
          assert (
              random_state["bit_generator"]
              == ref_state["bit_generator"]
          )
          assert random_state["state"] == ref_state["state"]
  
file_path: pytensor/tests/tensor/random/test_utils.py
imports: import numpy
  import pytest
  from pytensor import config, function
  from pytensor.compile.mode import Mode
  from pytensor.graph.rewriting.db import RewriteDatabaseQuery
  from pytensor.tensor.random.utils import RandomStream, broadcast_params, supp_shape_from_ref_param_shape
  from pytensor.tensor.type import matrix, tensor
  from tests import unittest_tools
label_desc: Use image node_id 3 for calling the TestSharedRandomStream obj's underlying member method code with example usage: obj.test_seed(rng_ctor) without return types