How to avoid specific value in random array after another specific is called?

This was too complicated for me so I extended my flat cube geometry platform instead. The previously had only one cube. So spawning with front SP and then Back SP would overlap the first and third cube along z axis. So I simply added few more cubes, shifted spawn points and also added rotational transform to create more randomness. Thanks for your help though. Your solution will help me if I encountered into such issue again.