Quote:
Originally Posted by Varyon
More likely:
3. If there are more than 1 targets of highest value, determine priority target randomly.
|
It's even easier than that. Make a list of targets. Assign each target a priority. Then do an indexed sort on the list (using heapsort, mergesort, quicksort, or whatever your favorite algorithm is) and take the top one. There will always be a top element in the list (as long as the size of the list is one or more), so there's no need to worry about random numbers.
Luke