private static List <Operation> ChooseRandomOperations(List <Operation> allOperations, int jobIndex, bool isComplexProduction) { int NumberOfOperations = 0; List <Operation> CloneOfOperations = allOperations.ConvertAll(operation => operation.Clone(jobIndex)); if (isComplexProduction) { NumberOfOperations = RandomGenerator.OperationsInJobForComplexProduction(); } else { NumberOfOperations = RandomGenerator.OperationsInJobForSmallScaleProduction(); } List <Operation> ChosenOperations = new List <Operation>(); for (int Index = 0; Index < NumberOfOperations && Index < CloneOfOperations.Count; Index++) { CollectionUtils.AddUniqeElementToList(ChosenOperations, CloneOfOperations); } return(ChosenOperations); }