private List <ShipmentPackageDTO> GenerateRandomPackageList() { List <ShipmentPackageDTO> packages = new List <ShipmentPackageDTO>(); int packageQuantity = RandomNumberHelper.GetRandomInt(_minQuantity, _maxQuantity); // Get unique 2 digit numbers IEnumerable <int> uniqueAddressNumbers = RandomNumberHelper.GetUniqueRandomNumbers(10, 99, packageQuantity); int[] uniqueAddressNumbersArray = uniqueAddressNumbers.ToArray(); // Get unique MINIMUM 8 digit numbers IEnumerable <int> uniquePackageNumbers = RandomNumberHelper.GetUniqueRandomNumbers(10000000, int.MaxValue, packageQuantity); int[] uniquePackageNumbersArray = uniquePackageNumbers.ToArray(); for (int i = 0; i < packageQuantity; i++) { var package = new ShipmentPackageDTO(); package.PackageWeightInKilos = RandomNumberHelper.GetRandomInt(_minWeight, _maxWeight); package.DeliveryAddressNumber = uniqueAddressNumbersArray[i].ToString(); package.PackageNumber = uniquePackageNumbersArray[i].ToString(); packages.Add(package); } // Order packages by weight so that maximum number of packages can be delivered in short time periods packages = packages.OrderBy(p => p.PackageWeightInKilos).ToList(); return(packages); }