随机产生不重复的数字
public void ShowRandomNum() { ArrayList list = new ArrayList(); Random rand = new Random(); for (int i = 0; i < 5; i++) { while (true) { int temp = rand.Next(0, 10); if (!list.Contains(temp)) { list.Add(temp); break; } Thread.Sleep(50); } } }