def apply_mixture(self, action: Any, axes: Sequence[int], prng) -> int | None:
        """Apply mixture to state.

        Args:
            action: The value with a mixture to apply.
            axes: The axes on which to apply the mixture.
            prng: The pseudo random number generator to use.
        Returns:
            The mixture index if the operation succeeded, otherwise None.
        """
        mixture = protocols.mixture(action, default=None)
        if mixture is None:
            return None
        probabilities, unitaries = zip(*mixture)

        index = prng.choice(range(len(unitaries)), p=probabilities)
        shape = protocols.qid_shape(action) * 2
        unitary = unitaries[index].astype(self._state_vector.dtype).reshape(shape)
        linalg.targeted_left_multiply(unitary, self._state_vector, axes, out=self._buffer)
        self._swap_target_tensor_for(self._buffer)
        return index
Apply mixture to state.

        Args:
            action: The value with a mixture to apply.
            axes: The axes on which to apply the mixture.
            prng: The pseudo random number generator to use.
        Returns:
            The mixture index if the operation succeeded, otherwise None.
        
cirq-core/cirq/sim/state_vector_simulation_state.py