@@ -9987,6 +9987,7 @@ class PauliString:
99879987 num_qubits: int,
99889988 *,
99899989 allow_imaginary: bool = False,
9990+ seed: int | None = None,
99909991 ) -> stim.PauliString:
99919992 """Samples a uniformly random Hermitian Pauli string.
99929993
@@ -9995,6 +9996,28 @@ class PauliString:
99959996 allow_imaginary: Defaults to False. If True, the sign of the result may be
99969997 1j or -1j in addition to +1 or -1. In other words, setting this to True
99979998 allows the result to be non-Hermitian.
9999+ seed: PARTIALLY determines the sampled Pauli string by deterministically
10000+ seeding the random number generator.
10001+
10002+ Must be None or an integer in range(2**64).
10003+
10004+ Defaults to None. When None, the prng is seeded from system entropy.
10005+
10006+ When set to an integer, making the exact same series calls on the exact
10007+ same machine with the exact same version of Stim will produce the exact
10008+ same Pauli string.
10009+
10010+ CAUTION: the Pauli string produced by a specific seed *WILL NOT* be
10011+ consistent between versions of Stim. This restriction is present to
10012+ make it possible to have future optimizations to the random sampling,
10013+ and is enforced by introducing intentional differences in the seeding
10014+ strategy from version to version.
10015+
10016+ CAUTION: the Pauli string produced by a specific seed *MAY NOT* be
10017+ consistent across machines that differ in the width of supported SIMD
10018+ instructions. For example, using the same seed on a machine that
10019+ supports AVX instructions and one that only supports SSE instructions
10020+ may produce different Pauli strings.
999810021
999910022 Examples:
1000010023 >>> import stim
@@ -11212,11 +11235,35 @@ class Tableau:
1121211235 @staticmethod
1121311236 def random(
1121411237 num_qubits: int,
11238+ *,
11239+ seed: int | None = None
1121511240 ) -> stim.Tableau:
1121611241 """Samples a uniformly random Clifford operation and returns its tableau.
1121711242
1121811243 Args:
1121911244 num_qubits: The number of qubits the tableau should act on.
11245+ seed: PARTIALLY determines the sampled tableau by deterministically
11246+ seeding the random number generator.
11247+
11248+ Must be None or an integer in range(2**64).
11249+
11250+ Defaults to None. When None, the prng is seeded from system entropy.
11251+
11252+ When set to an integer, making the exact same series calls on the exact
11253+ same machine with the exact same version of Stim will produce the exact
11254+ same tableau.
11255+
11256+ CAUTION: the tableau produced by a specific seed *WILL NOT* be
11257+ consistent between versions of Stim. This restriction is present to
11258+ make it possible to have future optimizations to the random sampling,
11259+ and is enforced by introducing intentional differences in the seeding
11260+ strategy from version to version.
11261+
11262+ CAUTION: the tableau produced by a specific seed *MAY NOT* be
11263+ consistent across machines that differ in the width of supported SIMD
11264+ instructions. For example, using the same seed on a machine that
11265+ supports AVX instructions and one that only supports SSE instructions
11266+ may produce different tableaus.
1122011267
1122111268 Returns:
1122211269 The sampled tableau.
0 commit comments