Skip to content

[mccall_q.md] Update np.random → Generator API - #959

Merged
kp992 merged 1 commit into
mainfrom
update-rng-mccall-q
Jul 31, 2026
Merged

[mccall_q.md] Update np.random → Generator API#959
kp992 merged 1 commit into
mainfrom
update-rng-mccall-q

Conversation

@Chihiro2000GitHub

Copy link
Copy Markdown
Contributor

Summary

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

np.random.seed(123) is replaced by an explicit rng = np.random.default_rng(123) (keeping the original fixed seed), and the np.random.random() calls inside the Qlearning_McCall jitclass are migrated to rng.random(). Following the style guide for jitclass code, rng is passed in as a method argument rather than stored as a class attribute, and threaded through run_epochs and its call sites. The notebook executes successfully under Numba.

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

@github-actions

Copy link
Copy Markdown

📖 Netlify Preview Ready!

Preview URL: https://pr-959--sunny-cactus-210e3e.netlify.app

Commit: 2af7e1b

📚 Changed Lectures


Build Info

@kp992
kp992 merged commit 4a5fad7 into main Jul 31, 2026
1 check passed
@kp992
kp992 deleted the update-rng-mccall-q branch July 31, 2026 23:28
@mmcky

mmcky commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

✅ Translation sync completed (zh-cn)

Target repo: QuantEcon/lecture-python.zh-cn
Translation PR: QuantEcon/lecture-python.zh-cn#229
Files synced (1):

  • lectures/mccall_q.md

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.

3 participants