Spurious mesh sensitivity is a major challenge in continuum finite element (FE) simulations of damage and fracture of quasibrittle structures. It has been shown that the existing localization limiters, which largely focus on energy regularization, are insufficient for addressing the issue of mesh sensitivity in stochastic analysis. In this study, we investigate the mathematical algorithm for mapping the continuous random fields of material properties onto the FE meshes. This is a fundamental problem in stochastic FE analysis, which has profound implications for the mesh sensitivity in the prediction of the statistics of failure behavior. We adopt a continuum damage constitutive model, and develop a mechanistic mapping method. The projection of the random fields of material properties onto the FE mesh is governed by the prevailing damage pattern of the element. The damage pattern of each finite element is determined based on the spatial distribution of the damage of its surrounding elements. Meanwhile, the prevailing damage pattern also dictates the energy regularization of the constitutive response of the finite element. The combination of energy regularization and mechanistic mapping method ensures that, for each time increment, the random tangential stiffness tensor of each finite element is calculated in accordance with the ongoing damage pattern. A direct consequence of the model is that, depending on the damage pattern, the statistics of the tangential stiffness tensor could vary with the mesh size. The model is applied to stochastic FE analysis of both notched and unnotched flexural specimens under different loading configurations, which exhibit different failure behaviors. The numerical analysis also considers different correlation lengths of the random fields of material properties. The simulation shows that, with the energy regularization scheme, the commonly used local mapping and local averaging methods could yield considerable mesh dependence of the statistics of the peak load capacity. The result also reveals the effect of correlation length on the spurious mesh dependence. By relating the mapping algorithm to the underlying damage pattern, the present model is able to mitigate the mesh sensitivity for different specimen geometries, loading configurations, and correlation lengths.