Skip to content

🌐 [translation-sync] [functions.md] Update np.random → Generator API#118

Open
mmcky wants to merge 2 commits intomainfrom
translation-sync-2026-05-04T05-31-40-pr-541
Open

🌐 [translation-sync] [functions.md] Update np.random → Generator API#118
mmcky wants to merge 2 commits intomainfrom
translation-sync-2026-05-04T05-31-40-pr-541

Conversation

@mmcky
Copy link
Copy Markdown
Contributor

@mmcky mmcky commented May 4, 2026

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.yml

Details

  • Source Language: en
  • Target Language: fa
  • Model: claude-sonnet-4-6

This PR was created automatically by the translation action.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 4, 2026

Deploy Preview for majestic-griffin-10b166 ready!

Name Link
🔨 Latest commit ba1cf2b
🔍 Latest deploy log https://app.netlify.com/projects/majestic-griffin-10b166/deploys/69f82f410438af0008980013
😎 Deploy Preview https://deploy-preview-118--majestic-griffin-10b166.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 4, 2026

✅ Translation Quality Review

Verdict: PASS | Model: claude-sonnet-4-6 | Date: 2026-05-04


📝 Translation Quality

Criterion Score
Accuracy 9/10
Fluency 9/10
Terminology 9/10
Formatting 9/10
Overall 9/10

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:

  • Adding Conditions - Note about equality testing: 'عبارت a == 10 با توجه به مقدارa میتواند True یا False ارزیابی شود' → 'عبارت a == 10 بسته به مقدار a، به True یا False ارزیابی می‌شود' (missing space before backtick around a, and more natural phrasing)

  • Exercises - func_ex3 solution second function description: 'در اینجا تابع دیگری برای دستگاه تصادفی دوم وجود دارد' → 'در اینجا تابعی برای دستگاه تصادفی دوم آورده شده است' (should be consistent with the phrasing used for the first function's description)


🔍 Diff Quality

Check Status
Scope Correct
Position Correct
Structure Preserved
Heading-map Correct
Overall 10/10

Summary: The translation correctly mirrors all source changes: replacing np.random.randn()/np.random.uniform() with rng-based calls, updating exercise instructions, and refining callable-object prose, all in the matching positions, with document structure and heading-map unchanged.


This review was generated automatically by action-translation review mode.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 with rng.standard_normal() / rng.uniform() and introduced rng = np.random.default_rng().
  • Updated the surrounding Persian explanation text to describe passing callables (functions/methods) more generally.
  • Updated .translate/state/functions.md.yml sync 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.

Comment thread lectures/functions.md
Comment on lines 317 to 322
def generate_data(n):
ϵ_values = []
for i in range(n):
e = np.random.randn()
e = rng.standard_normal()
ϵ_values.append(e)
return ϵ_values
Comment thread lectures/functions.md
Comment on lines 346 to +352
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()
Comment thread lectures/functions.md
@@ -378,18 +382,18 @@
ϵ_values.append(e)
return ϵ_values

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 4, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants