If you want uniform distribution100 million unique random number you should createcould do something like this:
Now using Fisher-Yates suffle algorithm:
List<int> numbers = new List<int>(100000000); for (int i = 0; i < numbers.Capacity; i++) { numbersint rnd = random.AddNext(inumbers.Count + 1); for(int i = 0; iif <(rnd == numbers.Count; i++Count) { int rnd = random.Next( numbers.CountAdd(i); intelse tmp = numbers[i]; { numbers[i] = numbers[rnd]; numbers.Add(numbers[rnd]); numbers[rnd] = tmp;i; } } By the way you could calculate irNotFound much faster:
int irNotFound = irFirst - hsGenerated.Count; Good luck with your quest.