def sample(self, multiplicity):
if self._n is None:<EOL><INDENT>return self._uniform_phi(multiplicity)<EOL><DEDENT>N = <NUM_LIT:0>  <EOL>phi = np.empty(multiplicity)  <EOL>pdf_max = <NUM_LIT:1> + <NUM_LIT:2>*self._vn.sum()  <EOL>while N < multiplicity:<EOL><INDENT>n_remaining = multiplicity - N<EOL>n_to_sample = int(<NUM_LIT>*pdf_max*n_remaining)<EOL>phi_chunk = self._uniform_phi(n_to_sample)<EOL>phi_chunk = phi_chunk[self._pdf(phi_chunk) ><EOL>np.random.uniform(<NUM_LIT:0>, pdf_max, n_to_sample)]<EOL>K = min(phi_chunk.size, n_remaining)  <EOL>phi[N:N+K] = phi_chunk[:K]<EOL>N += K<EOL><DEDENT>return phi<EOL>
r"""
        Randomly sample azimuthal angles `\phi`.

        :param int multiplicity: Number to sample.

        :returns: Array of sampled angles.