get the median number of a random array using O(n)