+ 2
How do u create a random letter generator that can choose any letter from A-C except the letter chosen by the user?? Pls help.C#
Its C#
3 ответов
+ 3
Man of PEACE can you clarify ? Are you saying that no matter what the user inputs you want a completely different letter to appear ?
+ 2
Yes, for instance if choose B the random generator can choose any letter between A & C but not B
+ 1
var l = new List<string>{ "A","B","C"};
string ans = Console.ReadLine();
int i = l.IndexOf(ans);
var rand = new Random();
int ri;
do {
ri = rand.Next(l.Count);
} while (i == ri);
Console.WriteLine(l[ri]);