Obtaining a random object with loops
Lets see if I can phrase this understandably (is that a word?)...
I have an array of class objects. I want to run through the entire array and choose a random one with a special attribute. I don't think I can explain it with english... must use second language, c++
I hope I worded this good enough. Its a difficult question to put into words. Thanks for the help!
// Pretend I just set the first 2 of the "listOfObj".Number to 1
// and the third's Number to 0.
// and I set each of their ID to their index in the array
// listOfObj.ID = 1 etc...
/*Now I want to collect all of the listOfObj's whose "Number" is equal to 1, and randomly choose one of them*/
//I do not have a clue about how to go about this