I have a specific list of values, which can be arrayed in a vector: AR = [-.5, -.3, -.1, 0, .1, .3, .5] (note that it is not important for the values to be arranged in a vector necessarily)
I want to specify a target mean. E.g.: TM = -.1
Then, I want ML to randomly select any N values (with replacement) from vector AR, as long as those N values yield the target mean. For example,
AR = [-.5, -.3, -.1, 0, .1, .3, .5] TM = -.1 N = 4
*magic code goes here, and ML gives:
Output = [-.3, .1, -.5, .3]
N randomly selected values from a given set with a mean of TM. Any ideas how to achieve this?
Best Answer