As in title, i need to draw a random number againist all objects of an array and remove object with lowest drawn number. One way will be to save all drawn values and then compare them with each other. Is there is an efficent way to do this? Pesudo code :
while(!myArray.isEmpty) {
for(String str : myArray) {
// draw a random number
// do some more stuff/save number into a map.
}
// remove object with lowest number (or draw again if there is conflict between lowest numbers)
}
Aucun commentaire:
Enregistrer un commentaire