Rock contains different mineral compositions as well as defects like microviods and microcracks, showing significant heterogeneity. For example, even for the same batch of rock samples, the deformation and failure experimental results have a certain degree of discreteness. In the present work, based on the conventional Weibull random distribution model of material heterogeneity, the spatial correlation scaling factor of heterogeneity is introduced to build the numerical model of rock with effective description of the heterogeneity of real rock. By selecting different heterogeneity factor (m) values and spatial scale factor (θ) values, the obtained heterogeneity distribution in the numerical models are similar to the spatial distribution and microstructure of actual rock surface images. Thereafter, the numerical manifold method(NMM), a numerical method that naturally represents continuous and discontinuous problems in a unified framework, is used to simulate the compression failure of heterogeneous disk and square numerical rock specimens. Results show that with the numerical rock model considering the heterogeneity described by the heterogeneity factor and the spatial scale factor, the discreteness of deformation and failure behaviors of rock can be well reproduced. In the future, the numerical manifold method will be used to further simulate and analyze the effecting mechanism of heterogeneity on the deformation and failure of rock and its engineering significance.