I have an array e.g. of length 10:
Population = {1,3,4,2,7,-2,0,8,9,5}.
I generate two random numbers between 0-9 (e.g. 4 and 6). So then I check the 4th and 6th elements (7, 0) and the "winner" is the number that is greater. So 7 goes into the winners array (5 winners in total):
Winners = {7, ...}
Each time I want to pair up two of the remaining numbers (including the losers) and put the winner into the winners array.
The easiest way to do this would be to use a non-fixed size array of size n and remove a winner from 'population' and put it into 'winners'. Then I could generate two random numbers between 1 and n-1 and continue the process.
How could I do this using a fixed-size array in Java? How could I select two numbers from my array, ignoring any numbers that are 'winners'?