Re: Probability Algorithm

2012-08-25 Thread 月忧茗
Thanks for helps This code almost meets my needs . But not accurate probability when not enough source elements. So I give up the not enough elements situation. For source list is growing fast, the bast situation just appear in the program starting 2012/8/26 Steven D'Aprano > On 08/25/2012

Re: Probability Algorithm

2012-08-25 Thread Steven D'Aprano
On 08/25/2012 12:03 PM, 月忧茗 wrote: > In the FinalList, > probability of ALIST's item appeared is 43% probability of BLIST's > item appeared is 37% probability of CLIST's item appeared is 19% > probability of DLIST's item appeared is 1% First, select one of the four lists with those approp

Re: Probability Algorithm

2012-08-25 Thread 月忧茗
Sorry, missing some conditions *already_picked_list* is get from db. > Why keep a counter? Rather than an iterated loop so , if use a iterated loop: for i in range(43): item = choice( ALIST ) ALIST.remove( item ) if item in already_picked_list: continue slot.appe

Re: Probability Algorithm

2012-08-25 Thread Dave Angel
On 08/25/2012 12:03 PM, 月忧茗 wrote: > Hi, All, > > I have a problem of probability algorithm > > > The goal is obtain a list which contains three items. as the *FinalList* > > There has Four source lists. * > ALIST, BLIST, CLIST, DLIST > > There are all Unk

Probability Algorithm

2012-08-25 Thread 月忧茗
Hi, All, I have a problem of probability algorithm The goal is obtain a list which contains three items. as the *FinalList* There has Four source lists. * ALIST, BLIST, CLIST, DLIST There are all Unknown length. They contains unique elements* ( In fact, there are all empty at the