Q&ABeginnerLab conventions

What does the seed do in the lab?

It fixes the random sequence used for sampling so counts repeat exactly on re-runs; leaving it empty gives different results each time.

Exact computations in the lab (amplitudes and probabilities) are always deterministic. Randomness enters only in sampling (shots), mid-circuit measurement, some experiments such as BB84, parameter initialisation in VQE and QML, and some optimisers such as SPSA.

When a numeric seed is set (for example 42), the lab uses a pseudo-random generator (mulberry32) that starts from that seed, so it gives the same results every time and on every device. This is useful for teaching (all students see the same numbers), for reproducing an experiment, and for comparing two settings with the randomness held fixed.

But do not base a conclusion on a single seed: change the seed several times to see how much the results fluctuate, especially in machine learning experiments, where accuracy may change from one seed to another. The generator is for teaching and is not suitable for cryptography.

Related topics

References

  1. IBM Quantum (2025). Qiskit SDK API documentation. IBM Quantum Documentation quantum.cloud.ibm.com