code: def test_external_rng():
      arch_mod = arch_model(
          None, mean="Constant", vol="GARCH", p=1, q=1
      )
      data = arch_mod.simulate(np.array([0.1, 0.1, 0.1, 0.88]), 1000)
      data.index = pd.date_range(
          "2000-01-01", periods=data.index.shape[0]
      )
  
      rand_state = np.random.RandomState(1)
      state = rand_state.get_state()
      volatility = GARCH(1, 0, 1)
      distribution = Normal(seed=rand_state)
      mod = ConstantMean(
          data.data, volatility=volatility, distribution=distribution
      )
      res = mod.fit(disp="off")
  
      rand_state.set_state(state)
      fcast_1 = res.forecast(
          res.params,
          horizon=5,
          method="simulation",
          start=900,
          simulations=250,
      )
      rand_state.set_state(state)
      rng = rand_state.standard_normal
      fcast_2 = res.forecast(
          res.params,
          horizon=5,
          method="simulation",
          start=900,
          simulations=250,
          rng=rng,
      )
      assert_allclose(
          fcast_1.residual_variance, fcast_2.residual_variance
      )
  
imports: import numpy
  from numpy.random import RandomState
  from numpy.testing import assert_allclose
  import pandas
  import pytest
  from arch.univariate import arch_model
  from arch.univariate.distribution import Normal, StudentsT
  from arch.univariate.mean import ConstantMean
  from arch.univariate.volatility import APARCH, EGARCH, FIGARCH, GARCH, HARCH, BootstrapRng, ConstantVariance, EWMAVariance, FixedVariance, MIDASHyperbolic, RiskMetrics2006
label_desc: Use image node_id 3 for calling a global function with example usage: test_external_rng() without return types