Is there an efficient way to generate a random combination of N integers such that—
min, max],
If you generate 0≤a≤1 of the random values in the range [l, x-1] uniformly, and 1-a of the random values in the range [x, h] uniformly, the expected mean would be:
m = ((l+x-1)/2)*a + ((x+h)/2)*(1-a)
So if you want a specific m, you can play with a and x.
For example, if you set x = m: a = (h-m)/(h-l+1).
To ensure closer-to-uniform probability for different combinations, choose a or x randomly from the set of valid solutions to the equation above. (x must be in the range [l, h] and should be (close to) an integer; N*a should be (close to) an integer as well.