  Quasi two-dimensional Coulomb systems have drawn widespread interest. The
reduced symmetry of these systems leads to complex collective behaviors, yet
simultaneously poses significant challenges for particle-based simulations. In
this paper, a novel method is presented for efficiently simulate a collection
of charges confined in doubly-periodic slabs, with the extension to scenarios
involving dielectric jumps at slab boundaries. Unlike existing methods, the
method is insensitive to the aspect ratio of simulation box, and it achieves
optimal O(N) complexity and strong scalability, thanks to the random batch
Ewald (RBE) approach. Moreover, the additional cost for polarization
contributions, represented as image reflection series, is reduced to a
negligible cost via combining the RBE with an efficient structure factor
coefficient re-calibration technique in k-space. Explicit formulas for optimal
parameter choices of the algorithm are provided through error estimates,
together with a rigorous proof. Finally, we demonstrate the accuracy,
efficiency and scalability of our method, called RBE2D, via numerical tests
across a variety of prototype systems. An excellent agreement between the RBE2D
and the PPPM method is observed, with a significant reduction in the
computational cost and strong scalability, demonstrating that it is a promising
method for a broad range of charged systems under quasi-2D confinement.
