public static List<int> GetRandom()
{
Random rnd = new Random();
List<int> list = new List<int>();
while (list.Count <= 26)
{
int randomNumber = rnd.Next(1, 26);
if (!list.Contains(randomNumber))
{
list.Add(randomNumber);
}
}
return list;
}
This is a code where I have tried to get a random list of integer(from 1 to 26) but this doesn't return me the desired result. Here I want a random int array without any repeat.