Skip to content

Commit

Permalink
Use randint instead of random.choice to generate input values
Browse files Browse the repository at this point in the history
  • Loading branch information
rtvuser1 committed Jun 6, 2024
1 parent d04a0c1 commit ec8b4b9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion hidden-shift/qiskit/hs_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ def execution_handler (qc, result, num_qubits, s_int, num_shots):
if 2**(num_qubits) <= max_circuits:
s_range = list(range(num_circuits))
else:
s_range = np.random.choice(2**(num_qubits), num_circuits, False)
# create selection larger than needed and remove duplicates (faster than random.choice())
s_range = np.random.randint(1, 2**(input_size), num_circuits + 10)
s_range = list(set(s_range))[0:max_circuits]

# loop over limited # of secret strings for this
for s_int in s_range:
Expand Down

0 comments on commit ec8b4b9

Please sign in to comment.