Skip to content

[schelling.md] Update np.random → Generator API#745

Open
Chihiro2000GitHub wants to merge 1 commit into
mainfrom
update-rng-schelling
Open

[schelling.md] Update np.random → Generator API#745
Chihiro2000GitHub wants to merge 1 commit into
mainfrom
update-rng-schelling

Conversation

@Chihiro2000GitHub
Copy link
Copy Markdown
Contributor

Summary

This PR migrates legacy NumPy random API usage in schelling.md as part of QuantEcon/meta#299.

The changes are confined to the exercise solution block. The main lecture flow uses Python's standard random module (not NumPy), so it is out of scope for this migration.

Details

  • Removed from numpy.random import uniform, randint
  • Added rng = np.random.default_rng() in the solution block, making the block self-contained
  • uniform(size=(n, 2))rng.uniform(size=(n, 2))
  • randint(0, high=2, size=n)rng.integers(0, 2, size=n)
  • uniform(), uniform()rng.uniform(), rng.uniform()
  • randint(0, n)rng.integers(0, n)
  • U = uniform()U = rng.uniform()

No fixed seed was introduced. No Numba-related code is present.

Hi @mmcky and @HumphreyYang, I'd be grateful if you could take a look when you have time.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented May 22, 2026

Deploy Preview for taupe-gaufre-c4e660 ready!

Name Link
🔨 Latest commit f2f03f5
🔍 Latest deploy log https://app.netlify.com/projects/taupe-gaufre-c4e660/deploys/6a100bf65482de000812601c
😎 Deploy Preview https://deploy-preview-745--taupe-gaufre-c4e660.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 22, 2026

@github-actions github-actions Bot temporarily deployed to pull request May 22, 2026 08:03 Inactive
@github-actions github-actions Bot temporarily deployed to pull request May 22, 2026 08:03 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant