Refactor data generation from sorting test.