Skip to content

[perm_income.md] Update np.random → Generator API#975

Merged
jstac merged 1 commit into
mainfrom
update-rng-perm-income
Jul 22, 2026
Merged

[perm_income.md] Update np.random → Generator API#975
jstac merged 1 commit into
mainfrom
update-rng-perm-income

Conversation

@Chihiro2000GitHub

Copy link
Copy Markdown
Contributor

Summary

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

Details

  • Replaced np.random.randn(T+1) in the @jit-decorated time_path with rng.standard_normal(T+1), passing rng in as an argument (time_path(T, rng)).
  • Added rng = np.random.default_rng() near the first use and updated both call sites to pass rng.
  • No fixed seed was introduced, so simulation behaviour is unchanged.

Note: time_path is jitted but has no parallel=True/prange, so rng is passed in as an argument per the style guide. Verified locally that this compiles and runs 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-975--sunny-cactus-210e3e.netlify.app

Commit: 25ccc60

📚 Changed Lectures


Build Info

@jstac

jstac commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Many thanks @Chihiro2000GitHub , nice work. Merging.

@jstac
jstac merged commit ab687aa into main Jul 22, 2026
1 check passed
@jstac
jstac deleted the update-rng-perm-income branch July 22, 2026 20:29
@mmcky

mmcky commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

\translate-resync

Second sync following #979. This PR merged before the workflow went live, so its perm_income.md change never reached QuantEcon/lecture-python.zh-cn — translate status reads it as OUTDATED. (First one, on #623, produced QuantEcon/lecture-python.zh-cn#198 with a clean verdict-v2 review.)

@mmcky

mmcky commented Jul 23, 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#199
Files synced (1):

  • lectures/perm_income.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