Skip to content

[ar1_processes.md] Update np.random → Generator API#794

Open
Chihiro2000GitHub wants to merge 1 commit into
mainfrom
update-rng-ar1-processes
Open

[ar1_processes.md] Update np.random → Generator API#794
Chihiro2000GitHub wants to merge 1 commit into
mainfrom
update-rng-ar1-processes

Conversation

@Chihiro2000GitHub

Copy link
Copy Markdown
Contributor

Summary

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

Details

The two migrated calls both appear in exercise solution blocks (the main text has no random draws). Each solution block defines its own rng via np.random.default_rng() and remains self-contained.

  • Exercise ar1p_ex1 solution (@njit function): np.random.randn()rng.standard_normal(). Since Numba cannot construct a Generator inside a jitted function, rng is passed in as an argument. The original implementation re-seeded with np.random.seed(1234) on every call to sample_moments_ar1, so a fresh rng = np.random.default_rng(1234) is created for each k in the calling loop to match that behaviour.
  • Exercise ar1p_ex3 solution: np.random.randn(n)rng.standard_normal(n), with no fixed seed (as in the original).

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

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@netlify

netlify Bot commented Jul 17, 2026

Copy link
Copy Markdown

Deploy Preview for taupe-gaufre-c4e660 ready!

Name Link
🔨 Latest commit b6c6345
🔍 Latest deploy log https://app.netlify.com/projects/taupe-gaufre-c4e660/deploys/6a5a17e2f8042b0008ca02f3
😎 Deploy Preview https://deploy-preview-794--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

github-actions Bot commented Jul 17, 2026

Copy link
Copy Markdown

@github-actions
github-actions Bot temporarily deployed to pull request July 17, 2026 12:02 Inactive
@github-actions
github-actions Bot temporarily deployed to pull request July 17, 2026 12:02 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.

1 participant