I was studying black body radiation and how quantization of energy solves the problem of ultraviolet catastrophe. But I have a very fundamental doubt. A black body can be assumed as a cavity with a small hole with radiation leaking out of it. As the temperature of the black body is increased we can assume the the charge particles, electrons, on the metal surface will behave as harmonic oscillators and the energy of the harmonic oscillation will be equal to the energy density of the radiation inside the cavity at thermal equilibrium.
My doubt is that at thermal equilibrium, the cavity(assuming it to be uniform) will have a uniform temperature. Since the oscillations of the charged particles is due to the thermal agitation, how can the charge particles radiate all over the frequency range? The temperature is uniform over the cavity, wont they all be experiencing same thermal agitation and oscillate at same frequency