From ec8b4b9ad71b07cfaf1e2d3e34dbcd46275babd3 Mon Sep 17 00:00:00 2001 From: rtvuser1 Date: Wed, 5 Jun 2024 21:14:24 -0700 Subject: [PATCH] Use randint instead of random.choice to generate input values --- hidden-shift/qiskit/hs_benchmark.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hidden-shift/qiskit/hs_benchmark.py b/hidden-shift/qiskit/hs_benchmark.py index dd451de5..6e707c2e 100644 --- a/hidden-shift/qiskit/hs_benchmark.py +++ b/hidden-shift/qiskit/hs_benchmark.py @@ -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: