Generate nearly sorted sequences with perturb and modularized store_data