I want to swap randomly 5 blocks (block has 5 diffrent color) and spawn in vertical line

108391-capture.png

i have 5 blocks(5 diffrent color) and i want to swap randomly it before spawning it
how i can do that
@dev-waqas
@Tespy
@pako
@Yo318

In Pseudo code:
var MyArray = new Array(1, 2, 3, 4, 5); var MyIndex = Random.Range(0,(MyArray.length - 1)); Debug.Log(MyArray[MyIndex]);
For every loop, remove the MyArray[MyIndex] from the array, and you will never reuse the already used position.
You migt consider using a List instead, since you have Add, Remove methods, where Arrays require some more housekeeping.