I'm trying to fill an array with random numbers. There must be unique. I've tried this:
int random(int[] arr) {
int number = 0;
for (int i = 0; i < arr.length; i++) {
Random rn = new Random();
number = rn.nextInt(100);
for (int j = i; j>0; j--) {
if(arr[j]==zahl){
random(arr);
}
}
}
return number;
}
I would be thankfull if you could help with my problem.