title: Finding the median value of a random array
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3691940/finding-the-median-value-of-an-array">Finding the median value of an array?</a><br>
    <a href="https://stackoverflow.com/questions/4191687/how-to-calculate-mean-median-mode-and-range-from-a-set-of-numbers">How to calculate mean, median, mode and range from a set of numbers</a><br>
    <a href="https://stackoverflow.com/questions/10609602/combine-quicksort-and-median-selection-algorithm">Combine QuickSort and Median selection algorithm</a>  </p>
  </blockquote>
  
  
  
  <p>How can I find the median values of a randomly generated array? </p>
  
  <p>For Example: It would give me an array like 88,23,93,65,22,43 . 
               The code I'm using finds the middle number but it's not sorted.</p>
  
  <p>Here is the code I'm using so far:</p>
  
  <pre><code>double Median()
  {
      int Middle = TheArrayAssingment.length / 2;
         if (TheArrayAssingment.length%2 == 1)
          {
             return TheArrayAssingment[Middle];
          }
      else {
          return (TheArrayAssingment[Middle-1] + TheArrayAssingment[Middle]) / 2.0;
      }
  }
  </code></pre>