Skip to content

feat: add time based seed to random.h - #457

Merged
awni merged 4 commits into
ml-explore:mainfrom
AvikantSrivastava:feat/random-seed
Jan 16, 2024
Merged

feat: add time based seed to random.h#457
awni merged 4 commits into
ml-explore:mainfrom
AvikantSrivastava:feat/random-seed

Conversation

@AvikantSrivastava

@AvikantSrivastava AvikantSrivastava commented Jan 14, 2024

Copy link
Copy Markdown
Contributor

Issue: #429

Proposed changes

The seed used in the random module was fixed to 0. This PR uses a time based seed for initialization

Checklist

Put an x in the boxes that apply.

  • 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
  • I have updated the necessary documentation (if needed)

@AvikantSrivastava
AvikantSrivastava marked this pull request as ready for review January 14, 2024 21:19
@AvikantSrivastava

Copy link
Copy Markdown
Contributor Author

@awni can you review this PR?

Comment thread mlx/random.h Outdated

@awni awni left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me. I would check that the tests pass to be sure we weren't relying on a the PRNG default anywhere.

@AvikantSrivastava

Copy link
Copy Markdown
Contributor Author

Looks good to me. I would check that the tests pass to be sure we weren't relying on a the PRNG default anywhere.

I have not added unittests for this particular change yet, should I add them?

I ran the existing test suite, all the test cases are passing

@awni awni left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the contribution, LGTM!

@awni
awni merged commit 4e290d2 into ml-explore:main Jan 16, 2024
@AvikantSrivastava
AvikantSrivastava deleted the feat/random-seed branch January 16, 2024 21:35
jzdziarski pushed a commit to jzdziarski/mlx that referenced this pull request Jul 26, 2026
* random seed from time

* fix: chrono

* refactor: snake case
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.

3 participants