1-9,随机数,不重复。

            Random rnd = new Random();
            ArrayList al = new ArrayList();

            for (int i = 1; i <= 9; i++)
            {
                al.Add(i);
            }

            ArrayList al2 = new ArrayList();

            while (al.Count > 0)
            {
                int i=rnd.Next(al.Count - 1);
             
                al2.Add(al[i]);

                al.RemoveAt(i);
            }

            if (al2[8].ToString().Equals("9"))
            {
                int i = rnd.Next(0, 8);
                int iz = Convert.ToInt32(al2[i].ToString());
                al2[8] = iz;
                al2[i] = 9;
            }

            this.textBox1.Text = al2[0] + "," +

posted @ 2010-03-10 17:34  binlunia  阅读(452)  评论(0编辑  收藏  举报