using System.Collections.Generic;
public static void Main()
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890".ToCharArray();
Random rndm = new Random();
List<string> passcodesList = new List<string>();
int numberOfInvigilators = 1000000000;
while(passcodesList.Count < numberOfInvigilators)
StringBuilder passcode = new StringBuilder();
for (int x = 0; x < passcodeLength; x++)
passcode.Append(chars[rndm.Next(0, chars.Length)]);
if (passcodesList.Contains(passcode.ToString())){
Console.WriteLine("Duplicate found! this took : " + iterations + " iterations, the code is : " + passcode.ToString());
passcodesList.Add(passcode.ToString());