One way might be this. Let S_j = sum_{i<j} h_i x_i. There is m_j such that Pr{S_j < m_j} < p_j and Pr{S_j <= m_j} >= p_j. Let t_j = (p_j - Pr{S_j < m_j})/Pr{S_j = m_j}. Take x_j = 1 if S_j < m_j, x_j = 0 if S_j > m_j, and x_j = 1 with probability t_j if S_j = m_j. Thus if the sum of the x_i chosen so far is too low, we make x_j=1 to compensate; if too high, we make x_j=0. I don't know how to estimate the amount of reduction in mean absolute (or squared) difference, however.
Department of Mathematics
http://www.math.ubc.ca/~israel University of British Columbia Vancouver, BC, Canada V6T 1Z2