generating random numbers between 1 to 8 for talent of candidate
Random rand = new Random ( ) ; for ( int i = 0 ; i < n ; i ++ ) candidate [ i ] = 1 + rand . nextInt ( ( 8 - 1 ) + 1 ) ; System . out . print ( " Candidate ▁ : ▁ " ) ; for ( int i = 0 ; i < n ; i ++ ) System . out . print ( i + 1 + " ▁ " ) ; System . out . println ( ) ; System . out . print ( " Talents ▁ : ▁ " ) ; for ( int i = 0 ; i < n ; i ++ ) System . out . print ( candidate [ i ] + " ▁ " ) ; printBestCandidate ( candidate , n ) ; } }