/// <summary>
/// 抽取随机数
/// </summary>
/// <param name="num"></param>
public void GetNum(int num)
{
int[] numList = new int[] { 10, 100, 52, 45, 78 }; // 随机数组
Random radom = new Random(); //随机数
List<int> list = new List<int>(); //输出数组
while (list.Count < num)
{
int temp = numList[radom.Next(0,numList.Length)]; //产生随机数
if (!list.Contains(temp))
{
list.Add(temp); //添加数组
}
}
// 输出随机数
for (int i = 0; i < list.Count; i++)
{
Response.Write(list[i]+" ");
}
}
/// 抽取随机数
/// </summary>
/// <param name="num"></param>
public void GetNum(int num)
{
int[] numList = new int[] { 10, 100, 52, 45, 78 }; // 随机数组
Random radom = new Random(); //随机数
List<int> list = new List<int>(); //输出数组
while (list.Count < num)
{
int temp = numList[radom.Next(0,numList.Length)]; //产生随机数
if (!list.Contains(temp))
{
list.Add(temp); //添加数组
}
}
// 输出随机数
for (int i = 0; i < list.Count; i++)
{
Response.Write(list[i]+" ");
}
}