I'm working with Visual Studio. I have an int array with 20 fields and I have a for-loop running 20 times to fill out all columns. It inserts the generated random numbers, and a while loop also looks if the random number exists in that array, if yes it's going to create a new random and run the while loop again and so on, until the for-loop is finished.
static int[] usedNumbers = new int[20];
public static void Show() {
for(int a = 0; a < 20; a++)
{
randomNr = Rnd.Next(0, 20);
searchRnd = true;
while (searchRnd)
{
if (usedNumbers.Contains(randomNr))
{
randomNr = Rnd.Next(0, 20);
searchRnd = true;
}
else {
searchRnd = false;
// code...
}
}
}
}
Show();
console.writeLine("{0}", usedNumbers[0]);
But for some reason when I run the console, this code isn't executed fully, I don't see nothing. Also the window doesn't close, it doesn't show the error message like it should when there is an error. Is there maybe a time limit or something like that?