> > I would like to optimally shuffle my 1 million records across my <N> > buckets so that the total quantity (based on the sum of each record's > quantity field) in each bucket is balanced (as much as possible) across > buckets. > > > > This sounds like the type of problem that has been solved before and > given a fancy algorithm name. >
I see the word 'shuffle' as-in 'distribute', and not any mention of 'random'. I would *assume* you want the 1 million records randomly distributed. Also your desire for "balanced as much as possible" is relative - balanced as in less than 2? 200? 463? Off the top of my head I'd randomize the 1 million records then feed them 1, 2, 3... to each bucket keeping a running total on each. Not sure about the probabilities but something tells me you should more or less be within 1000 of each other.... if not, do it again... Kinda brute force but that's all I got for ya at the moment... -- Matt Jarvis Eugene, Oregon USA _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/CAPT54rb0qioXsf9coYKL22dpa+yO0Wr3JP1TB2PGE1mk9RDQ=q...@mail.gmail.com ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

