@@ -606,8 +606,8 @@ def simulate_samuelson(
606606
607607 # Generate shocks if stochastic
608608 if σ > 0:
609- np.random.seed (seed)
610- ϵ = np.random .normal(0, 1, n)
609+ rng = np.random.default_rng (seed)
610+ ϵ = rng .normal(0, 1, n)
611611
612612 # Simulate forward
613613 for t in range(2, n):
@@ -1190,7 +1190,8 @@ C[1] = σ # Shock variance
11901190
11911191sam_t = LinearStateSpace(A, C, G, mu_0=μ_0)
11921192
1193- x, y = sam_t.simulate(ts_length=n)
1193+ rng = np.random.default_rng()
1194+ x, y = sam_t.simulate(ts_length=n, random_state=rng)
11941195
11951196fig, axes = plt.subplots(3, 1, sharex=True, figsize=(12, 8))
11961197titles = ["Output ($Y_t$)", "Consumption ($C_t$)", "Investment ($I_t$)"]
@@ -1303,8 +1304,8 @@ class SamuelsonLSS(LinearStateSpace):
13031304 except ValueError:
13041305 print("Stationary distribution does not exist")
13051306
1306- np.random.seed (seed)
1307- x, y = self.simulate(ts_length)
1307+ rng = np.random.default_rng (seed)
1308+ x, y = self.simulate(ts_length, random_state=rng )
13081309
13091310 fig, axes = plt.subplots(3, 1, sharex=True, figsize=(12, 8))
13101311 titles = ["Output ($Y_t$)",
0 commit comments