Skip to content

Commit c571121

Browse files
Update python_essentials to new API (#544)
1 parent 3241a07 commit c571121

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

lectures/python_essentials.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1068,10 +1068,11 @@ code.
10681068
```{code-cell} python3
10691069
import numpy as np
10701070
1071+
rng = np.random.default_rng()
10711072
n = 100
10721073
ϵ_values = []
10731074
for i in range(n):
1074-
e = np.random.randn()
1075+
e = rng.standard_normal()
10751076
ϵ_values.append(e)
10761077
```
10771078

@@ -1085,8 +1086,9 @@ for i in range(n):
10851086
Here's one solution.
10861087

10871088
```{code-cell} python3
1089+
rng = np.random.default_rng()
10881090
n = 100
1089-
ϵ_values = [np.random.randn() for i in range(n)]
1091+
ϵ_values = [rng.standard_normal() for i in range(n)]
10901092
```
10911093

10921094
```{solution-end}

0 commit comments

Comments
 (0)