Recently I've been reading a lot about blackbody radiation, Rayleigh-Jeans law, Planck's law and the UV catastrophe.
In deriving the Rayleigh-Jeans and Planck's laws, we are examining a perfectly reflecting cavity filled with radiating ideal gas. The gas and the radiation are in thermal equilibrium. In Rayleigh-Jeans law, it is assumed that as an ideal gas has the average energy of $1/2kT$ per degree of freedom, the radiation has the same average energy per mode.
This is somewhat understandable to me, as the radiation originates from the charged particles having average energy of $1/2kT$, it would be reasonable to assume the radiation has the same average energy. But how does an ideal gas radiate in the first place?
My understanding of the ideal gas model is that it is a collection of particles moving with constant speeds and are non-interacting except during collisions, which are fully elastic. But to radiate, a particle has to accelerate. Only situation I can think of where electrons in ideal gas accelerate are during collisions (they collide and change directions), but the collisions are elastic and there is no change in kinetic energies of the particles. So if the collisions are elastic, where does the energy to produce radiation come from?