C# 随机点名小程序

string[] arr = { "张三", "李四", "王五", "Curry", "James", "Kobe" };
Random rand = new Random();//实例化rand
string name1 = arr[rand.Next(0, arr.Length)];
//string name2 = arr[rand.Next(0, arr.Length)];
 Console.WriteLine("恭喜{0}中奖了", name1);

C# 随机点名小程序

 

上一篇:运算符


下一篇:python操作redis