Skip to content

Instantly share code, notes, and snippets.

@ayende
Created March 1, 2020 10:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ayende/19b552c8a6a29c8dad8ff02f95d01e09 to your computer and use it in GitHub Desktop.
Save ayende/19b552c8a6a29c8dad8ff02f95d01e09 to your computer and use it in GitHub Desktop.
var dic = new Dictionary<string, int> { ["A"] = 0, ["B"] = 0, ["C"] = 0 };
for (int i = 0; i < 10_000; i++)
{
var list = new List<string> { "A", "B", "C" };
list.Sort((x, y) => new Random().Next(0, 2));
dic[list[0]]++;
}
foreach (var kvp in dic)
{
Console.WriteLine(kvp.Key + " -> " + kvp.Value);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment