One effective optimization is to use a k-d tree, a spatial partitioning data structure that reduces the complexity of overlap checks to approximately O(log N ) per query . The k-d tree partitions the 3D simulation space hierarchically, enabling efficient nearest-neighbor or overlap queries. By replacing the O(N ) overlap check with O(log N ), the overall complexity of brute-force packing is reduced to approximately O(N log N ). This improvement can make random insertion competitive with more sophisticated methods like Packmol, particularly for large systems where the simplicity and flexibility of random insertion become advantageous.