You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Different seeds can give identical samples (noise seed has only 30 bits) #261
seed=None also draws just 30 bits (integers(0, 2**30)). By the birthday bound, a sweep over seeds 0…N has about N²/2³¹ colliding pairs. Seeds 0–300,000, for example, contain 46 pairs that give the same noise. For a noise-only circuit those pairs return bit-identical samples:
importnumpyasnp, stim, tsimc=tsim.Circuit(str(stim.Circuit.generated(
"surface_code:rotated_memory_z", distance=3, rounds=3,
after_clifford_depolarization=0.01)))
a=c.compile_detector_sampler(seed=37430).sample(100_000)
b=c.compile_detector_sampler(seed=43909).sample(100_000)
np.array_equal(a, b) # True: both seeds map to channel seed 644760479
With statevector components, the noise columns still match and only the component outcomes differ. Runs that combine several seeds, or treat them as independent, end up double-counting shots.
Possible fix: pass the full seed through, e.g. seed the channel sampler from np.random.default_rng([seed, 0]) or np.random.SeedSequence(seed).spawn(...), and give seed=None a 64-bit draw. That changes the samples you get for a given seed, so it's nicer to do before 1.0.0 than after.
Activity
Draw every random stream from the whole seed (QuEraComputing#263)