# Pick the highest of two (or $n$) independent uniformly distributed random numbers - average value?

With "random number" I mean an independent uniformly distributed random number.

### One

Picking one random number is easy: When I pick a random number from $x$ to $y$, the average value is $(x+y)/2$.

### Two

I'm no maths expert, nevertheless I was able to work out a solution for whole numbers: When I pick the highest of two random whole numbers from $x$ to $y$ ...

Let $n$ be the count of possible results $n = y - x + 1$.

I looked at the probability of every single possible outcome and noticed an arithmetic sequence. I knew the sequence had to start with the rarest possibility: Rolling two times in a row the lowest value.

$$p_1 = \frac{1}{n^2}$$

And I knew the sequence had to have a sum of 100 %. This made it possible to calculate the last, the $n$th, element:

$$p_n = \frac{2}{n} - p_1$$

Based on that it was easy to calculate the difference between elements and subsequently the formula for the sequence.

$$p_i = \frac{2in-2i-n+1}{n^3-n^2}$$

All I had to do now, was multiplying the probabilities with their respective values and sum this.

$$\sum_{i=1}^{n} \frac{2in-2i-n+1}{n^3-n^2}(x+i-1)$$

### Questions

What sort of distribution is this, how is it called? I can't name it and I can hardly search for it.

What is the solution for picking the highest of two random real numbers from $x$ to $y$? I feel a little bit lost, because my approach fails, because there are infinite real numbers.

What is the solution for picking the highest of $c$ random real numbers from $x$ to $y$?

-
Conjecture: $(x+y) \cdot 2/3$, and in general, $(x+y) \cdot c/(c+1)$ – George V. Williams May 12 '13 at 0:08
I do not think so: Rolling two dice and picking the highest value averages to 4.47 (see this question). Using your formula the result would be 4.67. – Kaini May 12 '13 at 9:07

For $n$ iid discrete uniform random variables the PDF is
$$P(Y_{max}=y)=\left(\frac{\lfloor y\rfloor-a+1}{b-a+1}\right)^n-\left(\frac{\lfloor y\rfloor-a}{b-a+1}\right)^n$$
For $n$ iid continuous uniform random variables the PDF is
$$f_{Y_{max}}(y)=\begin{cases}n\left(\frac{1}{b-a}\right)^{n-1}\left(\frac{y-a}{b-a}\right)^{n} &,y\in[a,b]\\ 0&,\text{otherwise}\\ \end{cases}$$