Generation

generate functionSat, 12 Nov 2022

Given a list of names, randomly match each name with another name

public static string[] GetMatches(string[] names) { List<string> shuffledNames = new List<string>(names); shuffledNames.Shuffle(); return names.Zip(shuffledNames, (n1, n2) => n1 + " -> " + n2).ToArray(); }

Questions about programming?Chat with your personal AI assistant