lundi 1 février 2021

How to pick a random instance of an element from an array?

For example, I have School[] testSchool = new School {Teacher, Student, Principal, Student, Janitor};, and I want to pick a random instance of student to preform a method (assume all the elements are different objects), how would I do that?




Aucun commentaire:

Enregistrer un commentaire