20150506--不重复的随机(备忘)
Random suiji = new Random(); int[] shuzu = new int[5]; for (int i = 0; i < 5; i++) { shuzu[i] = suiji.Next(1, 6); for (int j = 0; j < i; j++) { if (shuzu[i] == shuzu[j]) { i--; break; } } } foreach (int q in shuzu) { Console.WriteLine(q); } Console.ReadLine();