Randomly spawning text

Hey , i need to make the bottom digits(these are answers A,B,C,D) to randomly spawn in positions
A,B,C,D so they just need to swap places like B,D,A,C i tried this

public Text[] odpowiedzi;
    public Text[] filler;
    private int numberOfBoxes;
    private int numberOfFillers;
 void Start()
    {

        numberOfBoxes = odpowiedzi.Length;
        numberOfFillers = filler.Length;

        for (int boxNumber = 0; boxNumber < numberOfBoxes; boxNumber++)
        {
            int fill = Random.Range(0, numberOfFillers);
            odpowiedzi[boxNumber].text = filler[fill].text;
        }
}

But it doesnt really work. Can anyone help me please? :slight_smile:

if you create a new temporary list clone of filler before your for statement, you can remove a random one from the temporary list and add that one in filler[boxNumber] slot.

i kinda figured it out but now i have one more problem this is my code:

 public Transform playerSpawnPoints;//the parent of the spawn points
    public Transform[] spawnPoints;
    private bool lastRespawnToggle = false;
    public bool reSpawn;
 void Start()
    {
        spawnPoints = playerSpawnPoints.GetComponentsInChildren<Transform>();
       
    }
    public void Respawn()
    {
        print("respawn");
        int i;//= Random.Range(1, spawnPoints.Length);
       A.transform.position = spawnPoints[i=Random.Range(1, spawnPoints.Length)].transform.position;
        B.transform.position = spawnPoints[i = Random.Range(1, spawnPoints.Length)].transform.position;
        C.transform.position = spawnPoints[i = Random.Range(1, spawnPoints.Length)].transform.position;
        D.transform.position = spawnPoints[i = Random.Range(1, spawnPoints.Length)].transform.position;
    }

A cant be == to B or C or D , spawnpoint of A must be one of a kind

now my only problem left is how can i prevent this ^ variable i not to be same on A,B,C,D
because sometimes its just answers are over answers just check the image. If i solve this problem then all will be perfectly fine :slight_smile:


Solved

oh great its solved… wasted my google search