Skip to content

Conversation

@arnavk23
Copy link
Contributor

@arnavk23 arnavk23 commented Jan 4, 2026

  • Add optional rng::AbstractRNG keyword and positional arguments to randstate, randunitary, randchannel, and randsymplectic
  • Add RNG support to homodyne measurement interface
  • Thread RNG through all internal random generation functions
  • Add Random to test dependencies
  • Add tests for deterministic RNG behavior
  • Maintain backward compatibility with default_rng() defaults
  • Fixes Add optional rng arguments to random methods #65

If you want to submit an unfinished piece of work in order to get comments and discuss, please mark the pull request as a draft and ping the repository maintainer.

Please address only one topic or issue per pull request! Many small PRs are much easier to review and merge than one large PR.

Before merging, all changes and new functionality should be marked in the CHANGELOG file, but feel free to just leave your CHANGELOG notes in the PR description, to avoid merge conflicts with other requests modifying that file. The maintainer will add these CHANGELOG notes for you if you do so.

Before considering your pull request ready for review and merging make sure that all of the following are completed (please keep the clecklist as part of your PR):

  • The code is properly formatted and commented.
  • Substantial new functionality is documented within the docs.
  • All new functionality is tested.
  • All of the automated tests on github pass.
  • We recently started enforcing formatting checks. If formatting issues are reported in the new code you have written, please correct them. There will be plenty of old code that is flagged as we are slowly transitioning to enforced formatting. Please do not worry about or address older formatting issues -- keep your PR just focused on your planned contribution.

If possible, keep your git history not too wild (rebase and squash commits, keep commits small and semantically separated) so that review is easier.

- Add optional `rng::AbstractRNG` keyword and positional arguments to randstate, randunitary, randchannel, and randsymplectic
- Add RNG support to homodyne measurement interface
- Thread RNG through all internal random generation functions
- Add Random to test dependencies
- Add tests for deterministic RNG behavior
- Maintain backward compatibility with default_rng() defaults
@arnavk23 arnavk23 changed the title Add optional rng arguments to random methods (#65) Add optional rng arguments to random methods Jan 4, 2026
@codecov
Copy link

codecov bot commented Jan 4, 2026

Codecov Report

❌ Patch coverage is 87.32394% with 9 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@fe93427). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/randoms.jl 84.74% 9 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main      #91   +/-   ##
=======================================
  Coverage        ?   97.13%           
=======================================
  Files           ?       19           
  Lines           ?     2510           
  Branches        ?        0           
=======================================
  Hits            ?     2438           
  Misses          ?       72           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@arnavk23
Copy link
Contributor Author

arnavk23 commented Jan 4, 2026

@apkille All tests pass. Please review this pr. Thanks!

Copy link
Member

@apkille apkille left a comment

Choose a reason for hiding this comment

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

Looks good. I think the flexibility between passing rng as an optional first argument and a keyword argument is ok. Usually I would say just do the former, as that would be the idiomatic Julia decision. But for many of these methods, one would then be passing 4-5 arguments, which is a bit yucky, so a kwarg might be better.

Thanks for the contribution again!

@apkille apkille merged commit 6b48ed5 into QuantumSavory:main Jan 5, 2026
15 of 16 checks passed
@arnavk23 arnavk23 deleted the issue-65-rng branch January 5, 2026 16:29
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.

Add optional rng arguments to random methods

2 participants