When creating a sampler from a stim.Circuit (say, for example, using stim.Circuit.compile_sampler), one can provide a seed to the random number generator to make sure the simulation is reproducible.

However, I am looking at an error model that requires me to manually apply operations to a stim.TableauSimulator instead. Is there a way/workaround to also allow me to seed the random number generator used by the stim.TableauSimulator.measure?


1 Answer 1


Since v1.10, you can give a seed argument to stim.TableauSimulator.__init__:

import stim

shots = []
for _ in range(5):

    # Make seeded simulator.
    simulator = stim.TableauSimulator(seed=5)


for shot in shots:
    assert shot == shots[0]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.