I’m trying to take a random amount of elements from stringListA and add it to stringListB. I also want to randomize the order of elements that are added to stringListB. I was able to randomize the order but I’m not sure how to randomize the amount.
public class RandomAmountAndOrder : MonoBehaviour {
public List <string> stringListA;
public List <string> stringListB;
void Start(){
stringListA = new <string>(){
"one",
"two",
"three",
"four",
"five",
};
for (int a = 0; a < text.Length; a++){
stringListB = new <string>(){
stringListA[UnityEngine.Random.Range(0, 5)],
stringListA[UnityEngine.Random.Range(0, 5)],
stringListA[UnityEngine.Random.Range(0, 5)],
stringListA[UnityEngine.Random.Range(0, 5)],
stringListA[UnityEngine.Random.Range(0, 5)],
};
}
}
}