I need a function $f(x)$ such that given a set of values $X=\{x1, x2, ...\}$ and a function $rand()$ that returns a value between 0 and 1, $f(x)$ returns a value that increases with x such that the probability that $f(a)$ returns a value greater than $f(b)$ is $\frac{a}{b}$: $P[f(a) \ge f(b)] = \frac{a}{b} \forall\ a,b\ \epsilon \ X$ For example, given the set $X=\{1,2,4\}$ and a function $f(x)$ as described above, if one calculated $f(1)$, $f(2)$, and $f(4)$, there would be a 4/7 chance that $f(4)$ is largest, 2/7 chance that $f(2)$ is largest, and 1/7 chance that $f(1)$ is largest.