Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix seed in StatevectorSampler #98

Merged
merged 8 commits into from
Aug 28, 2024
Merged

Fix seed in StatevectorSampler #98

merged 8 commits into from
Aug 28, 2024

Conversation

timmintam
Copy link
Collaborator

If we set the seed of StatevectorSampler as an int, it will always sample the same single outcome. We need to set the seed to an numpy.random.Generator to have reproducible samples (with each shot giving a different outcome).

@timmintam timmintam marked this pull request as draft August 23, 2024 14:16
@timmintam timmintam marked this pull request as ready for review August 26, 2024 16:03
@timmintam timmintam marked this pull request as draft August 26, 2024 16:11
@timmintam
Copy link
Collaborator Author

I opened an issue in qiskit regarding this bug. We can switch to using Generator seed instead of int until this is fixed.

@timmintam timmintam marked this pull request as ready for review August 27, 2024 12:46
Copy link
Member

@mrossinek mrossinek left a comment

Choose a reason for hiding this comment

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

Since this has now become a bug-fix, please add a release note which explains the fix regarding the use of the seed.

@mrossinek mrossinek merged commit 65f7f58 into main Aug 28, 2024
10 checks passed
@mrossinek mrossinek deleted the seed-statevector-sampler branch August 28, 2024 15:02
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