QuantEcon · GitHub

Commit 06af1a9

Chihiro2000GitHubHumphreyYang

and

authored

Update need_for_speed to new API (#545)

Co-authored-by: Humphrey Yang <39026988+HumphreyYang@users.noreply.github.com>

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • lectures

Lines changed: 2 additions & 1 deletion

Original file line numberDiff line numberDiff line change

@@ -340,8 +340,9 @@ The following vectorized code uses NumPy, which we'll soon investigate in depth,

340340

to achieve the same thing.

341341
342342

```{code-cell} ipython

343+

rng = np.random.default_rng()

343344

with qe.Timer():

344-

x = np.random.uniform(0, 1, n)

345+

x = rng.uniform(0, 1, n)

345346

y = np.sum(x**2)

346347

```

347348

0 commit comments

Comments

 (0)

Read the original on github.com ↗