A simple proof is given of the optimality of the procedure of D. E. Knuth and A. C. Yao for transforming a random number with distribution

into one with distribution

. A direct representation of the cost (average number of input symbols needed to output one symbol) of the optimal transformation is given in terms of entropy, a procedure that leads to a refined entropic upper bound to the cost.