Skip to content

Commit

Permalink
make tests deterministic
Browse files Browse the repository at this point in the history
  • Loading branch information
eliottrosenberg committed Jul 1, 2024
1 parent ea4b288 commit 47f5aac
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cirq-core/cirq/experiments/readout_confusion_matrix_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def _add_noise_and_mitigate_ghz(
- The statstical uncertainty of the previous output
"""
if rng is None:
rng = np.random.default_rng()
rng = np.random.default_rng(0)
confusion_matrices = [
np.array([[1 - e0, e1], [e0, 1 - e1]]) for e0, e1 in zip(zero_errors, one_errors)
]
Expand All @@ -236,7 +236,7 @@ def _add_noise_and_mitigate_ghz(
)

measurements = _sample_ghz(n, repetitions, rng)
noisy_measurements = add_readout_error(measurements, zero_errors, one_errors)
noisy_measurements = add_readout_error(measurements, zero_errors, one_errors, rng)
# unmitigated:
p1 = np.mean(np.sum(noisy_measurements, axis=1) % 2)
z = 1 - 2 * np.mean(p1)
Expand Down

0 comments on commit 47f5aac

Please sign in to comment.