Returns probability of choosing a pair with maximum sum .
function findMaxSumProbability ( $ a , $ n ) { $ total = $ n * ( $ n - 1 ) / 2 ; $ max_sum_pairs = countMaxSumPairs ( $ a , $ n ) ; return ( float ) $ max_sum_pairs / ( float ) $ total ; }