  The chromo-electromagnetic field is produced due to the motion of partons in
a quark-gluon plasma created by relativistic heavy-ion collisions. The
fluctuations in the produced chromo-electromagnetic field are important, since
they cause heavy quarks to gain energy in the low velocity limit. We study the
effect of such fluctuations on heavy quark diffusion in quark-gluon plasma
within the framework of Langevin dynamics under the background matter described
by the ($3+1$)-dimensional relativistic viscous hydrodynamics. Theoretical
calculations of the nuclear modification factor ($R_{AA}$) of heavy mesons ($D$
and $B$ mesons), with the effect of these fluctuations, are compared with
experimental measurements in $Au-Au$ collisions at $\sqrt{s_{NN}} = 200$ GeV by
the STAR experiment at the BNL Relativistic Heavy Ion Collider (RHIC) and
$Pb-Pb$ collisions at $\sqrt{s_{NN}} = 2.76$ and $5.02$ TeV by the ALICE and
CMS experiments at the CERN Large Hadron Collider (LHC). We find a significant
effect of these fluctuations in describing the the measured $R_{AA}$ of $D$ and
$B$ mesons in both RHIC and LHC energies.
