Hi I'm trying to code basic console Pexeso game in C#. And I'm wondering how to generate one and only one pair of capital letters.
So far my code can genereate string with random capital letters but I don't know how to control it to generate only two and only two from each one.
string chars = "AABBCCDDEEFFGGHHIIJJKKLL";
var stringChars = new char[24];
Random random = new Random();
for (int i = 0; i < stringChars.Length; i++)
{
stringChars[i] = chars[random.Next(chars.Length)];
}
string finalString = new String(stringChars);
Console.WriteLine(finalString);
Thank you very much for your help.
Aucun commentaire:
Enregistrer un commentaire