Skip to content

[time_series_with_matrices.md] Update np.random → Generator API#740

Open
Chihiro2000GitHub wants to merge 2 commits into
mainfrom
update-rng-time-series-with-matrices
Open

[time_series_with_matrices.md] Update np.random → Generator API#740
Chihiro2000GitHub wants to merge 2 commits into
mainfrom
update-rng-time-series-with-matrices

Conversation

@Chihiro2000GitHub
Copy link
Copy Markdown
Contributor

Summary

This PR migrates legacy NumPy random API usage in time_series_with_matrices.md as part of QuantEcon/meta#299.

  • Introduced rng = np.random.default_rng() at the first point of random use (the code cell with σ_u = 2. in the "Adding a random term" section) and reused it throughout the main lecture flow.
  • Updated population_moments.sample_y to accept an optional rng=None parameter with an internal fallback; the call site in the main flow passes rng=rng.
  • No fixed seed introduced (the original lecture did not use np.random.seed()).
  • No Numba-related code in this file.

Details

  • Replaced np.random.normalrng.normal (5 instances) and np.random.randrng.random (3 instances).
  • The signature change sample_y(self, n, rng=None) is backwards-compatible due to the default argument.
  • Verified that the notebook executes successfully and the full HTML build completes without errors in a local build.

Hi @mmcky and @HumphreyYang, I'd be grateful if you could take a look when you have time.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented May 18, 2026

Deploy Preview for taupe-gaufre-c4e660 ready!

Name Link
🔨 Latest commit 32ac86d
🔍 Latest deploy log https://app.netlify.com/projects/taupe-gaufre-c4e660/deploys/6a0e9e5ba00f9e0007d484b1
😎 Deploy Preview https://deploy-preview-740--taupe-gaufre-c4e660.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 18, 2026

@github-actions github-actions Bot temporarily deployed to pull request May 18, 2026 07:12 Inactive
@github-actions github-actions Bot temporarily deployed to pull request May 18, 2026 07:18 Inactive
@github-actions github-actions Bot temporarily deployed to pull request May 21, 2026 06:03 Inactive
@github-actions github-actions Bot temporarily deployed to pull request May 21, 2026 06:03 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants