Skip to content

Commit bacb91b

Browse files
committed
Update translation: lectures/python_essentials.md
1 parent 6f36a65 commit bacb91b

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

lectures/python_essentials.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,10 +1074,11 @@ def linapprox(f, a, b, n, x):
10741074
```{code-cell} python3
10751075
import numpy as np
10761076
1077+
rng = np.random.default_rng()
10771078
n = 100
10781079
ϵ_values = []
10791080
for i in range(n):
1080-
e = np.random.randn()
1081+
e = rng.standard_normal()
10811082
ϵ_values.append(e)
10821083
```
10831084

@@ -1091,9 +1092,10 @@ for i in range(n):
10911092
这是一种解法。
10921093

10931094
```{code-cell} python3
1095+
rng = np.random.default_rng()
10941096
n = 100
1095-
ϵ_values = [np.random.randn() for i in range(n)]
1097+
ϵ_values = [rng.standard_normal() for i in range(n)]
10961098
```
10971099

10981100
```{solution-end}
1099-
```
1101+
```

0 commit comments

Comments
 (0)