I have a game that displays patterns on the screen based off order. I don't want this order to be very strict to one order like 1 2 3 4 5 6
I would like the order to be more random. So I am trying to create a method that will generate a random order from 1-6
. I tried to create a method that would do so but I failed. Could anyone help me out with that.
P.s. This is in java btw.
public static Random rand = new Random();
public static int[] array = new int[]{0,0,0,0,0,0};
public static void main(String[] args)
{
for(int i =0;i<6;i++)
{
for (int a =0;a<6;a++)
{
array[i] = rand.nextInt(6)+1;
while(array[i] == array[a])
{
array[i] = rand.nextInt(6)+1;
}
}
}
}