Skip to content

Add warning when default random number generator is used#461

Open
thierry-martinez wants to merge 9 commits intoTeamGraphix:masterfrom
thierry-martinez:reproducibility_warnings
Open

Add warning when default random number generator is used#461
thierry-martinez wants to merge 9 commits intoTeamGraphix:masterfrom
thierry-martinez:reproducibility_warnings

Conversation

@thierry-martinez
Copy link
Collaborator

@thierry-martinez thierry-martinez commented Mar 8, 2026

This commit adds a warning when ensure_rng is called with None.

It includes the following fixes:

This PR subsumes #459.

This commit adds a warning when `ensure_rng` is called with `None`.

It includes the following fixes:

- In `DepolarisingNoiseModel`, the field `rng` has been removed: the
  current API favors passing `rng` as a method parameter instead of
  storing it inside the structure.

- `rand_dm` and `rand_channel_kraus` now use the `rng` passed as a
  parameter for the entire computation, instead of relying partially on
  the default random number generator.

- Since TeamGraphix#235 appears not to have been properly fixed,
  `test_full_reduce_toffoli` is marked as `xfail`.
@codecov
Copy link

codecov bot commented Mar 8, 2026

Codecov Report

❌ Patch coverage is 96.49123% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.85%. Comparing base (927aa4b) to head (2697eee).

Files with missing lines Patch % Lines
graphix/noise_models/noise_model.py 85.71% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master     #461   +/-   ##
=======================================
  Coverage   88.85%   88.85%           
=======================================
  Files          44       44           
  Lines        6533     6535    +2     
=======================================
+ Hits         5805     5807    +2     
  Misses        728      728           

☔ 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.

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