Skip to content

Conversation

@Satyam12singh
Copy link
Contributor

Proposed changes

The documentation under "Boolean masks follow NumPy semantics" uses the example:

a[mx.random.randn(10, 10) > 0.0] = 0

However, MLX does not implement mx.random.randn. Running this code produces:

AttributeError: module 'mlx.core.random' has no attribute 'randn'

This PR replaces the invalid call with the correct MLX API:

mx.random.normal((10, 10))

This makes the documentation runnable and consistent with the current MLX API.

Checklist

Put an x in the boxes that apply.

  • [ x] I have read the CONTRIBUTING document
  • I have run pre-commit run --all-files to format my code / installed pre-commit prior to committing changes
  • I have added tests that prove my fix is effective or that my feature works
  • [ x] I have updated the necessary documentation (if needed)

Copy link
Member

@angeloskath angeloskath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@angeloskath angeloskath merged commit f7a4009 into ml-explore:main Dec 9, 2025
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.

2 participants