Skip to content

Commit 95cbe66

Browse files
authored
🌐 [translation-sync] [python_essentials.md] Update np.random → Generator API (#117)
* Update translation: lectures/python_essentials.md * Update translation: .translate/state/python_essentials.md.yml
1 parent 2f9981a commit 95cbe66

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
source-sha: 6d0df81899e042268a0081b71af2cedc438613b5
2-
synced-at: "2026-03-20"
3-
model: unknown
4-
mode: RESYNC
1+
source-sha: c5711217457a71e75710450b7b379fac9d05af1b
2+
synced-at: "2026-05-02"
3+
model: claude-sonnet-4-6
4+
mode: UPDATE
55
section-count: 7
6-
tool-version: 0.13.0
6+
tool-version: 0.14.1

lectures/python_essentials.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1063,10 +1063,11 @@ def linapprox(f, a, b, n, x):
10631063
```{code-cell} python3
10641064
import numpy as np
10651065
1066+
rng = np.random.default_rng()
10661067
n = 100
10671068
ϵ_values = []
10681069
for i in range(n):
1069-
e = np.random.randn()
1070+
e = rng.standard_normal()
10701071
ϵ_values.append(e)
10711072
```
10721073

@@ -1080,9 +1081,10 @@ for i in range(n):
10801081
یک راه‌حل این است:
10811082

10821083
```{code-cell} python3
1084+
rng = np.random.default_rng()
10831085
n = 100
1084-
ϵ_values = [np.random.randn() for i in range(n)]
1086+
ϵ_values = [rng.standard_normal() for i in range(n)]
10851087
```
10861088

10871089
```{solution-end}
1088-
```
1090+
```

0 commit comments

Comments
 (0)