//指定数组的一个随机值
int []a = new int[] { 5,3,56};
Random ran = new Random();
int c = ran.Next(a.Length);
Console.WriteLine(a[c]);
Console.ReadLine();
C#数组中随机获取一个值
最新推荐文章于 2024-06-13 15:56:06 发布
//指定数组的一个随机值
int []a = new int[] { 5,3,56};
Random ran = new Random();
int c = ran.Next(a.Length);
Console.WriteLine(a[c]);
Console.ReadLine();