yeetyoottoot
yeetyoottoot
CC#
Created by yeetyoottoot on 1/31/2024 in #help
does this work for choosing a random item in a list then removing it then choosing again
int randomNumber = Random.Range(spawnInts[0], spawnInts.Count);
spawnInts.RemoveAt(randomNumber);
randomNumber = Random.Range(spawnInts[0], spawnInts.Count);
int randomNumber = Random.Range(spawnInts[0], spawnInts.Count);
spawnInts.RemoveAt(randomNumber);
randomNumber = Random.Range(spawnInts[0], spawnInts.Count);
does this make it so when i choose a 2nd time i cant get the number i removed
10 replies
CC#
Created by yeetyoottoot on 1/25/2024 in #help
i dont understand why sometimes this code works and sometimes i get an infinite loop
public List<List<int>> roomMatrix = new List<List<int>>
{
new List<int> {-1, -1, -1},
new List<int> {-1, -1, -1},
new List<int> {-1, -1, -1}
};

public List<List<bool>> roomsVisited = new List<List<bool>>
{
new List<bool> {false, false, false},
new List<bool> {false, false, false},
new List<bool> {false, false, false}
};

public List<List<bool>> roomsValid = new List<List<bool>>
{
new List<bool> {false, false, false},
new List<bool> {false, false, false},
new List<bool> {false, false, false}
};

// Start is called before the first frame update
public List<List<int>> roomMatrix = new List<List<int>>
{
new List<int> {-1, -1, -1},
new List<int> {-1, -1, -1},
new List<int> {-1, -1, -1}
};

public List<List<bool>> roomsVisited = new List<List<bool>>
{
new List<bool> {false, false, false},
new List<bool> {false, false, false},
new List<bool> {false, false, false}
};

public List<List<bool>> roomsValid = new List<List<bool>>
{
new List<bool> {false, false, false},
new List<bool> {false, false, false},
new List<bool> {false, false, false}
};

// Start is called before the first frame update
12 replies