I have a really specific problem to solve and i'm looking for an existing algorithm to help me (i hope i'm in the right section of stackExchange).
I would have to make "random" association between items but all association need to have to answer to specific conditions.
var items = [12, 32, 25, 11, 8, 2, 4, 3, 8, 9];
All couples sum need to be between "20"(include) and "27"(include).
result = [[12,9], [11,9], [25,2], ...];
This is a really "simple" exemple. I need to implement this with at least 3 or 4 items by couples but the conditions is almost the same.
Is it an algorithm that existing to easly do this kind of stuff ? Or did i need to iterate all couples possibilities to pick up randomly after ? Even a way to iterate less for the generation of all couples would be nice.
Thank you a lot for your help.