int[] loto=new int[7];
Random rnd = new Random();
for (int i = 0; i < 7; i++)
{
int rast = rnd.Next(1,50);
for (int j = 0; j < i; j++)
if (loto[i] == rast)
loto[i] = 0;
i--;
break;
}
loto[i] = rast;
Array.Sort(loto);
foreach (int sira in loto)
Console.Write(sira + " ");
Console.ReadKey();