List<int> list = new List<int>(10);
Random r=new Random();
int num = 0;
for (int i = 0; i < 10; i++)
{
num = r.Next(0, 10);
if (!list.Contains(num))
{
list.Add(num);
}
else {
i--;
}
}