1
$\begingroup$

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?

$\endgroup$

1 Answer 1

2
$\begingroup$

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)

    simulator.h(*range(10))
    shots.append(simulator.measure_many(*range(10)))

for shot in shots:
    print(shot)
    assert shot == shots[0]
$\endgroup$

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.