CDFSIM: efficient stochastic simulation through decomposition of cumulative distribution functions of transformed spatial patterns. Simulation of categorical and continuous variables is performed using a new pattern-based simulation method founded upon coding spatial patterns in one dimension. The method consists of, first, using a spatial template to extract information in the form of patterns from a training image. Patterns are grouped into a pattern database and, then, mapped to one dimension. Cumulative distribution functions of the one-dimensional patterns are built. Patterns are then classified by decomposing the cumulative distribution functions, and calculating class or cluster prototypes. During the simulation process, a conditioning data event is compared to the class prototype, and a pattern is randomly drawn from the best matched class. Several examples are presented so as to assess the performance of the proposed method, including conditional and unconditional simulations of categorical and continuous data sets. Results show that the proposed method is efficient and very well performing in both two and three dimensions. Comparison of the proposed method to the filtersim algorithm suggests that it is better at reproducing the multi-point configurations and main characteristics of the reference images, while less sensitive to the number of classes and spatial templates used in the simulations.