string[] animals = { "alpacas", "capybaras", "chickens", "ducks", "emus", "geese", "goats", "iguanas", "kangaroos", "lemurs", "llamas", "macaws", "ostriches", "pigs", "ponies", "rabbits", "sheep", "tortoises", }; plan_school_visit("School A"); plan_school_visit("School B", 3); plan_school_visit("School C", 2); void plan_school_visit(string school, int groups = 6) { randomize_animals(); string[,] group = assign_group(groups); Console.WriteLine(school); print_group(group); Console.WriteLine(); } void randomize_animals() { Random random = new Random(); for (int i = 0; i < animals.Length; i++) { int r = random.Next(i, animals.Length); string temp = animals[r]; animals[r] = animals[i]; animals[i] = temp; } } string[,] assign_group(int group = 6) { string[,] result = new string[group, animals.Length / group]; int start = 0; for (int i = 0; i < group; i++) { for (int j = 0; j < result.GetLength(1); j++) { result[i, j] = animals[start++]; } } return result; } void print_group(string[,] group) { for (int i = 0; i < group.GetLength(0); i++) { Console.Write($"Group {i + 1}: "); for (int j = 0; j < group.GetLength(1); j++) { Console.Write($"{group[i,j]} "); } Console.WriteLine(); } }