随机输出数组中的一个数
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]; }