This is inspired by a puzzle (related to the two-envelopes problem) that I've seen in several places, including unbounded generalizations. The basic premise is that Alice chooses two real numbers from $[0,1]$ uniformly at random, and writes them down on slips of paper. Bob chooses one slip of paper at random, reads the number, and may either keep that slip or switch for the other. Bob's score is the number he ends up with, and our task is to maximize his expected value. The standard solution is for Bob to choose his own real number uniformly at random, and switch if the number he picks is greater than what's on the slip he holds.
However, this is not the only solution. Bob has one piece of data, $x$, and the use of a random number generator. He can keep his initial slip with some probability $f(x)$ and swap with probability $1-f(x)$. Call this function $f(x)$ his strategy; the standard solution corresponds to strategy $f(x)=x$. We calculate his expected winnings as $$E=\iint_{[0,1]\times[0,1]} f(x)x+(1-f(x))y\, dx dy=\int_0^1f(x)(x-0.5)+0.5\,dx$$
Trying $f(x)=x$ gives $E=0.58\overline{3}$, while $f(x)=x^{1.4}$ gives $E\approx 0.585784$.
UPDATE: In the comments Calvin Lin suggests $f(x)=\begin{cases}0&x<0.5\\1&x>0.5\end{cases}$, with $E=0.6125$.
What's the highest $E$ Bob can achieve, and what is the corresponding $f$?
The maximum, if Bob knew what was on the others slip, is $2/3$, so the answer must be less than that.
Then, the expected value is $\int_{\frac{1}{2}}^1 x, dx + (\frac{1}{2}) \frac{1}{2} = 0.625.$
– Calvin Lin Jul 01 '13 at 02:43