🌐 [translation-sync] [functions.md] Update np.random → Generator API#118
🌐 [translation-sync] [functions.md] Update np.random → Generator API#118
Conversation
✅ Deploy Preview for majestic-griffin-10b166 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Translation Quality ReviewVerdict: PASS | Model: claude-sonnet-4-6 | Date: 2026-05-04 📝 Translation Quality
Summary: The translation of the changed sections (Random Draws, Adding Conditions, and Exercises) is of high quality. Technical terminology is handled consistently and correctly, mathematical content is preserved, and the Persian reads naturally with appropriate academic register. Two minor issues were found: a missing space before a backtick and a slight inconsistency in phrasing between the two solution descriptions in func_ex3. Overall, this is a strong translation that accurately conveys the source content. The Random Draws section is translated accurately and fluently, preserving the technical meaning of terms like 'bound' (متصل) and maintaining the step-by-step explanation structure. The Adding Conditions section correctly handles the technical nuances of callable objects and the if/else syntax explanation, including the important distinction between = and == operators. The Exercises section maintains consistency with the glossary, correctly translating 'binomial random variable' as 'متغیر تصادفی دوجملهای' and preserving all mathematical notation. Code blocks, LaTeX math, and MyST directives are all correctly preserved throughout the changed sections. The translation of the hint in func_ex2 ('If U is uniform on (0,1)...') is natural and accurate in Persian. Suggestions:
🔍 Diff Quality
Summary: The translation correctly mirrors all source changes: replacing This review was generated automatically by action-translation review mode. |
There was a problem hiding this comment.
Pull request overview
This automated translation-sync PR updates the Persian functions lecture to use NumPy’s Generator API (np.random.default_rng()) instead of the legacy np.random.* calls, and refreshes the translation state metadata accordingly.
Changes:
- Replaced
np.random.randn()/np.random.uniform()usage withrng.standard_normal()/rng.uniform()and introducedrng = np.random.default_rng(). - Updated the surrounding Persian explanation text to describe passing callables (functions/methods) more generally.
- Updated
.translate/state/functions.md.ymlsync metadata (source SHA, date, model, tool version).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| lectures/functions.md | Migrates random-draw examples and exercise text/solutions to the default_rng() / Generator API and adjusts the explanatory text. |
| .translate/state/functions.md.yml | Updates translation sync state (source SHA, synced-at, model, mode, tool version). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| def generate_data(n): | ||
| ϵ_values = [] | ||
| for i in range(n): | ||
| e = np.random.randn() | ||
| e = rng.standard_normal() | ||
| ϵ_values.append(e) | ||
| return ϵ_values |
| def generate_data(n, generator_type): | ||
| ϵ_values = [] | ||
| for i in range(n): | ||
| if generator_type == 'U': | ||
| e = np.random.uniform(0, 1) | ||
| e = rng.uniform(0, 1) | ||
| else: | ||
| e = np.random.randn() | ||
| e = rng.standard_normal() |
| @@ -378,18 +382,18 @@ | |||
| ϵ_values.append(e) | |||
| return ϵ_values | |||
|
|
|||
Automated Translation Sync
This PR contains automated translations from QuantEcon/lecture-python-programming.
Source PR
#541 - [functions.md] Update np.random → Generator API
Files Updated
lectures/functions.md.translate/state/functions.md.ymlDetails
This PR was created automatically by the translation action.