if we want to design a uniform distribution that have a expectation of M in a area [a, b], so we can transform this problem into:
p(x) = w1 * U(a, seperate) + w2 * U(seperate, b), with w1 + w2 = 1, and a <= seperate <= b.
the w1, w2 is the sampling rate from each sub area of the original area[a,b]. And the seperate can be chosed by any value only make sure it
meet that conditioon--a <= seperate <= b. So at last put the a and b into the above equation, then we get two equations:
w1 * Mean(U(a, seperate)) + w2 * Mean(U(seperate, b)) = M ------------------------ equation 1
w1 + w2 = 1-----------------------------------------------------------------------equation 2
Mean(U(a, seperate)) = (a+seperate)/2--------------------------------equation 3
Mean(U(seperate, b)) = (seperate+b)/2-------------------------------equation 4
by these four equations, we can know the w1 and w2., so we know know to sampling in each sub-area to get the target expectation in
a area[a, b].