2. What random element? How to make
If an array list is used, then a simple random index within the array list will work.
Eg...
List contains 3 colors. We want a random one.
colors[0] = Red
colors[1] = Green
colors[2] = Blue
We choose a random index by getting a random integer in the range of 0 to 2 inclusive (there is a native/GUI function that does this). We then use that random number as an index for the array. Obviously store it to a local / locally used global as we cannot "recomputed" a random number.
For the rest of this post I assume you have computed this random number and it rolled 1.
RandomIndex = 1
3. undestand but how implement that element
Using a local or locally used global as described above. You then replace that index with the maximum index value and decrement the size of the array list (discarding the maximum value).
Eg.
Initial condition
colors[0] = Red
colors[1] = Green
colors[2] = Blue
ColorsMax = 3
RandomIndex = random integer between 0 and (ColorsMax - 1)
RandomIndex = 1 (this was the result of above)
color = colors[RandomIndex] // We need this later
ColorsMax = ColorsMax - 1
colors[RandomIndex] = colors[ColorsMax]
After this has run the list looks as such...
colors[0] = Red
colors[1] = Blue
ColorsMax = 2
Just set the player's color to color (computed as described above).
Or call the function again, or loop again. Depends on how you want to implement it.