while(i < 9) { a = randomnr(10)+1; check = 0; for(j = 0; j < 9; j++) { if(a == numbers[j]) { check = 1; } } if(check == 0) { numbers[j] = a; i++; } }