Skip to content

Seed the simulator RNG in test_multiple_shots to make it deterministic - #454

Merged
ciaranra merged 2 commits into
devfrom
fix-neo-flaky-seed
Aug 7, 2026
Merged

Seed the simulator RNG in test_multiple_shots to make it deterministic#454
ciaranra merged 2 commits into
devfrom
fix-neo-flaky-seed

Conversation

@ciaranra

@ciaranra ciaranra commented Aug 7, 2026

Copy link
Copy Markdown
Member

test_multiple_shots intermittently fails its statistical 50/50 assertion (observed "got 70/30" on PR #453's unrelated CI run, ~8e-5 per-run odds on a fair coin at n=100). The test fixes the runner seed, but measurement outcomes draw from the simulator's own RNG, which SparseStab::new seeds from entropy — so the outcomes were never deterministic.

Fix: construct the simulator with SparseStab::with_seed(1, 42). The test is now fully deterministic (verified identical results across repeated runs); the assertion itself is unchanged.

Note for the RNG backlog (issue #332): CircuitRunner::with_seed not governing measurement randomness is the underlying wart; this change makes the test honest without preempting the canonical RNG plumbing work.

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.

1 participant