I've been trying to pull values from an enum and store them as a String in an array. However, depending on a variable, the values have to be unique, i.e. the same value can't be used twice.
I've used the following code to pull values:
public enum Colour
{
    ROOD, GEEL, GROEN, BLAUW, PAARS;
    public Colour getRandomColour(Random rn)
    {
        return values()[rn.nextInt(values().length)];
    }
}
However, this can give duplicate values.
It seems that the values of my enum refuse to be put in code blocks. Sorry!
EDIT:
for (int i = 0; i < code.length; i++) 
            code[i] = kleur.getRandomColour(rn).toString();
It fills up the array 'code'. The array-length depends on several factors but it will always be smaller than or equal to the amount of values in the enum.
 
     
     
    