I have a large datasets of values that range from 0 to n. I am interpreting the values as probabilities for a later pseudo-random selection process. To make the values serve as probabilities, I normalize the entire dataset to the range (0.0:1.0) by dividing every number by n. Values are essentially random, and could be like {0.0156, 0.259, 0.0844, 0.904, ...}
After this, the dataset mean is not what I need it to be. (The end user will be specifying the desired mean). I need to transform (or dilate) all values so that the mean of the transformed dataset equals the desired mean, but the range constraint is unchanged. How can I do this?
Note, my question here is similar to How to simulate data that satisfy specific constraints such as having specific mean and standard deviation?, but the answers to that question do not constrain the range.
Edit
I have come up with a brute force iterative guessing approach to get the transformed mean to be within a tolerance of the target mean, but it will be slow. So now my question really is: Is there a closed form solution to get this exact?