Skip to content

Conversation

@justinpan0
Copy link
Contributor

Support both numpy RandomState and Generator for RNG handling in simulators #6567

@justinpan0
Copy link
Contributor Author

Updating the random number generation methods across various files in the cirq-core package to use the newer np.random.Generator instead of the older np.random.RandomState.

One small hack:

  1. For random_state.py, directly assigning RandomState._bit_generator could not yield the same result as Generator, even though the RandomState object is created with the same seed; instead I tried to get the RandomState's seed by the following line, and construct from there:
np.random.default_rng(random_state.get_state()[1][0])

Updates to random number generation:

@CirqBot CirqBot added the size: M 50< lines changed <250 label Jan 18, 2025
@justinpan0 justinpan0 force-pushed the random-number-generator-arg branch from c700603 to 8c7fe15 Compare January 22, 2025 03:35
@github-actions
Copy link

This pull request has been automatically labeled as stale because 90 days have passed without comments or other activity. If no further activity occurs and the status/stale label is not removed by a maintainer within 60 days, this pull request will be closed. If you would like to restore its active status, please leave a comment here; doing so will cause the staleness handler to remove the label.

If you have questions or feedback about this process, we welcome your input. You can open a new issue to let us know (please also reference this issue there, for continuity), or reach out to the project maintainers at [email protected].

@github-actions github-actions bot added status/stale This has been closed due to inactivity for an extended period of time. and removed status/stale This has been closed due to inactivity for an extended period of time. labels Apr 23, 2025
@NoureldinYosri
Copy link
Collaborator

thanks for starting this PR, do you still want to continue working on it?

@github-actions
Copy link

github-actions bot commented Sep 3, 2025

This pull request has been automatically labeled as stale because 90 days have passed without comments or other activity. If no further activity occurs and the status/stale label is not removed by a maintainer within 60 days, this pull request will be closed. If you would like to restore its active status, please leave a comment here; doing so will cause the staleness handler to remove the label.

If you have questions or feedback about this process, we welcome your input. You can open a new issue to let us know (please also reference this issue there, for continuity), or reach out to the project maintainers at [email protected].

@github-actions github-actions bot added status/stale This has been closed due to inactivity for an extended period of time. and removed status/stale This has been closed due to inactivity for an extended period of time. labels Sep 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: M 50< lines changed <250

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants