code: def sample_bitstrings(self, n_samples):
          
          if self.rs is None:
              raise ValueError("You have tried to perform a stochastic operation without setting the "
                               "random state of the simulator. Might I suggest using a PyQVM object?")
  
          # note on reshape: it puts bitstrings in lexicographical order.
          # would you look at that .. _all_bitstrings returns things in lexicographical order!
          # reminder: qubit 0 is on the left in einsum simulator.
          probabilities = np.abs(self.wf.reshape(-1)) ** 2
          possible_bitstrings = all_bitstrings(self.n_qubits)
          inds = self.rs.choice(2 ** self.n_qubits, n_samples, p=probabilities)
          return possible_bitstrings[inds, :]
docs: Sample bitstrings from the distribution defined by the wavefunction.
  
          Qubit 0 is at ``out[:, 0]``.
  
          :param n_samples: The number of bitstrings to sample
          :return: An array of shape (n_samples, n_qubits)