代码
#region 生成不同随机数的方法
/// <summary>
/// 生成不同随机数的方法
/// </summary>
/// <param name="min">最小值</param>
/// <param name="max">最大值</param>
/// <param name="count">取xx个</param>
/// <returns>int数组</returns>
private static int[] GetRandom(int min, int max, int count)
{
int[] maxArray = new int[max];
for (int i = 0; i < max; i++)
{
maxArray[i] = min + i;
}
int[] rArray = new int[count];
Random rd = new Random();
int temp = max;
for (int i = 0; i < count; i++)
{
int tIndex = rd.Next(0, temp);
rArray[i] = maxArray[tIndex];
maxArray[tIndex] = maxArray[--temp];
}
return rArray;
}
#endregion