In real-world scenarios, high-quality data are often scarce and imbalanced, yet it is essential for the optimal performance of data-driven algorithmic models. Data synthesis methods are commonly used to address this issue; however, they typically rely heavily on the original dataset, which limits their ability to significantly improve performance. This article presents a quality function-based method for directly generating high-quality data and applies it to a mesh generation algorithm to demonstrate its efficiency and effectiveness. The proposed approach samples input–output pairs of the algorithm based on their feature spaces, selects high-quality samples using a defined quality function that evaluates the suitability of outputs for their corresponding inputs, and trains a feedforward neural network to learn the mapping relationship using the selected data. Experimental results show that the learning cost is significantly reduced while maintaining competitive performance compared to two representative meshing algorithms.