diff --git a/src/braket/default_simulator/density_matrix_simulation.py b/src/braket/default_simulator/density_matrix_simulation.py index c5cc248d..651beb22 100644 --- a/src/braket/default_simulator/density_matrix_simulation.py +++ b/src/braket/default_simulator/density_matrix_simulation.py @@ -108,7 +108,8 @@ def _apply_operations( return np.reshape(dm_tensor, (2**qubit_count, 2**qubit_count)) def retrieve_samples(self) -> list[int]: - return np.random.choice( + rng_generator = np.random.default_rng() + return rng_generator.choice( self._density_matrix.shape[0], p=self.probabilities, size=self._shots ) diff --git a/src/braket/default_simulator/state_vector_simulation.py b/src/braket/default_simulator/state_vector_simulation.py index ef13604e..1f9f7a01 100644 --- a/src/braket/default_simulator/state_vector_simulation.py +++ b/src/braket/default_simulator/state_vector_simulation.py @@ -107,7 +107,8 @@ def _apply_operations( return np.reshape(final, 2**qubit_count) def retrieve_samples(self) -> list[int]: - return np.random.choice(len(self._state_vector), p=self.probabilities, size=self._shots) + rng_generator = np.random.default_rng() + return rng_generator.choice(len(self._state_vector), p=self.probabilities, size=self._shots) @property def state_vector(self) -> np.ndarray: