I'm trying to write a function that takes some aggregate information about a list of numbers (currency), and returns a concrete list with those properties. So for example, I'll ask for a list with an average of $265.43, a sum of $6,000, a max of $1,000 etc. And I will get a full list in return, whose values average to $265.43, sum to $6,000, etc. There may be many lists that satisfy the properties, but I don't need to enumerate them all, I just need any one of them to be returned.
Here are the list's properties:
- It has a length of N
- It sums to S
- The average is A
- The lowest number is L
- The highest number is H
- It matches a breakdown of dollar ranges:
- There are X values less than $75
- There are Y values between $75 and $200
- There are Z values greater than $200
I would like to pass values in for each of these parameters, and have a list returned which matches them. I have a few hundred of these sets { N, S, A, L, H, X, Y, Z } but I don't have any of the backing lists that were used to produce them. I don't need my generated lists to be exactly the same as the original lists, I just need them to look the same as the originals, from an aggregate point of view.
I would like to call it like this --> list = gimmeThatList(N, S, A, L, H, X, Y, Z)
I'm not sure where to even start looking for information on this, so any help is appreciated, even if it's just a link or a google search term. Some real code would be nice, if you can spare the time, but I'll take what I can get.