sorry, now reading my reply again made me realize I used 'prefix' to describe 2 different things.
I meant generate all possible combinations, classify those combinations by weight and, given a weight range, randomly choose from this 'combination pool'