someone who just started here. Trying to create a program to generate an array full with numbers in specific range but in random order. I compile this, everything seems okay, but doesn't work. Anyone can clarify why?
EDIT: I want values from 1 to 10 to appear in the array in random order. Problem is, the main for loop keeps looping and I can not get result. And please don't offer any better or somehow advanced solutions. It's not about the solution, I am trying to learn and would like to know where the problem is with this code.
import java.util.*;
public class CustomSorter
{
public static void main(String[] args)
{
int reqemlerinSayi = 10;
int[] esasSiyahi= new int[reqemlerinSayi];
Random random = new Random();
int reqem;
boolean toqqushur = false;
for (int i = 0; i < esasSiyahi.length; i++)
{
reqem = random.nextInt(reqemlerinSayi-1)+1;
for (int j = 0; j < esasSiyahi.length; j++)
{
if (esasSiyahi[j] == reqem)
toqqushur = true;
}
if (toqqushur)
i--;
else
esasSiyahi[i] = reqem;
toqqushur = false;
}
for (int i = 0; i < esasSiyahi.length; i++)
{
System.out.println(esasSiyahi[i]);
}
}
}