  Quantum error correction and symmetries play central roles in quantum
information science and physics. It is known that quantum error-correcting
codes covariant with respect to continuous symmetries cannot correct erasure
errors perfectly (an important case being the Eastin-Knill theorem), in
contrast to the case without symmetry constraints. Furthermore, there are
fundamental limits on the accuracy of such covariant codes for approximate
quantum error correction. Here, we consider the quantum error correction
capability of random covariant codes. In particular, we show that
$U(1)$-covariant codes generated by Haar random $U(1)$-symmetric unitaries,
i.e. unitaries that commute with the charge operator (or conserve the charge),
typically saturate the fundamental limits to leading order in terms of both the
average- and worst-case purified distances against erasure noise. We note that
the results hold for symmetric variants of unitary 2-designs, and comment on
the convergence problem of charge-conserving random circuits. Our results not
only indicate (potentially efficient) randomized constructions of optimal
$U(1)$-covariant codes, but also reveal fundamental properties of random
charge-conserving unitaries, which may underlie important models of complex
quantum systems in wide-ranging physical scenarios where conservation laws are
present, such as black holes and many-body spin systems.
