Skip to content

Commit

Permalink
fix random seed
Browse files Browse the repository at this point in the history
  • Loading branch information
t-imamichi committed May 29, 2024
1 parent 0e7d658 commit a05deb9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions test/terra/backends/test_parameterized_qobj.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,9 @@ def test_run_path_with_more_params_than_expressions(self):
circuit.ry(phi, 1)
circuit.measure_all()
parameter_binds = [{theta: [0, pi, 2 * pi], phi: [0, 1, pi]}]
res = backend.run(circuit, shots=shots, parameter_binds=parameter_binds).result()
res = backend.run(
circuit, shots=shots, parameter_binds=parameter_binds, **self.BACKEND_OPTS
).result()
counts = res.get_counts()
for index, expected in enumerate(
[{"00": shots}, {"01": 0.25 * shots, "11": 0.75 * shots}, {"10": shots}]
Expand Down Expand Up @@ -317,7 +319,9 @@ def test_run_path_with_more_params_than_expressions_multiple_circuits(self):
circuit.ry(phi, 1)
circuit.measure_all()
parameter_binds = [{theta: [0, pi, 2 * pi], phi: [0, 1, pi]}] * 3
res = backend.run([circuit] * 3, shots=shots, parameter_binds=parameter_binds).result()
res = backend.run(
[circuit] * 3, shots=shots, parameter_binds=parameter_binds, **self.BACKEND_OPTS
).result()
counts = res.get_counts()
for index, expected in enumerate(
[{"00": shots}, {"01": 0.25 * shots, "11": 0.75 * shots}, {"10": shots}] * 3
Expand Down
3 changes: 2 additions & 1 deletion test/terra/states/test_aer_densitymatrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ def test_QFT(self):

def test_two_qubit_QV(self):
"""Test single qubit QuantumVolume"""
state = AerDensityMatrix(QuantumVolume(2))
state = AerDensityMatrix(QuantumVolume(2, seed=1111))
state.seed(1111)
counts = state.sample_counts(shots=1024)
self.assertEqual(4, len(counts))
self.assertTrue("00" in counts)
Expand Down

0 comments on commit a05deb9

Please sign in to comment.