The role played by electron density fluctuations near the plasma edge on rf current drive in tokamaks is assessed quantitatively. For this purpose, a general framework for incorporating density fluctuations in existing modelling tools has been developed. It is valid when rf power absorption takes place far from the fluctuating region of the plasma. The ray-tracing formalism is modified in order to take into account time-dependent perturbations of the density, while the Fokker-Planck solver remains unchanged. The evolution of the electron distribution function in time and space under the competing effects of collisions and quasilinear diffusion by rf waves is determined consistently with the time scale of fluctuations described as a statistical process.