Firstly, set Random class −
Random random = new Random();
Set a range under the Next() method. This displays a letter between 0 and 26.
int a = random.Next(0, 26);
Here is the complete code −
Example
using System;
using System.IO;
using System.Linq;
class Demo {
static void Main() {
Random random = new Random();
// random lowercase letter
int a = random.Next(0, 26);
char ch = (char)('a' + a);
Console.WriteLine(ch);
}
}Output
t