using System.Collections.Generic;
Random random = new Random();
string[] colours = { "Red", "Green", "Blue", "Yellow" };
int sockCount = random.Next(10, 21);
List<string> sockDrawer = new List<string>();
for (int i = 0; i < sockCount; i++)
sockDrawer.Add(colours[random.Next(colours.Length)]);
Console.WriteLine("Socks in the drawer:");
Console.WriteLine("[ " + string.Join(" ", sockDrawer) + " ]\n");
Console.WriteLine($"Total socks: {sockCount}\n");
foreach (string colour in colours)
int count = sockDrawer.Count(s => s == colour);
Console.WriteLine($"{colour}: {count} socks, {pairs} pairs");
Console.WriteLine($"\nTotal pairs: {totalPairs}\n");
double probability = sockDrawer.Sum(s => (sockDrawer.Count(c => c == s) - 1) / 2.0) / ((sockCount * (sockCount - 1)) / 2.0);
Console.WriteLine($"Chance of picking a matching pair: {probability:P2}");