随机输出数组中的一个数

 

        int num = 0;
        private void button1_Click(object sender, EventArgs e)
        {
            num += 1;
            string[] str1 = new string[] { "A", "B", "C" };
            string[] str = new string[6];
            str[0] = "AA";
            str[1] = "BB";
            str[2] = "CC";
            str[3] = "DD";
            str[4] = "EE";
            str[5] = "FF";
            Random r = new Random();
            int j = r.Next(0, str.Length - 1); //r.Next(最小,最大)  返回一个指定范围内的数
            label1.Text = ""+num.ToString()+"次 :" + str[j];

        }

 

posted @ 2012-10-30 16:31  bdf216  阅读(488)  评论(0编辑  收藏  举报