C generates instances of random number lists that do not repeat
- 2020-05-09 19:11:19
- OfStack
/// <summary>
/// Generates a random number list instance that does not repeat
/// </summary>
/// <param name="count"> Do not repeat the count </param>
/// <returns> Do not repeat the list of Numbers </returns>
private static List<int> GetRandomList(int count)
{
List<int> list = new List<int>();
int num = 0;
Random rnd = new Random();
for (int i = 0; i < count; i++)
{
do
{
num = rnd.Next(010000, 1000000);
} while (list.Contains(num));//
list.Add(num);
}
return list;
}