Sorry,   missing some conditions<br><br><b>already_picked_list</b>   is get from db.<br><br>>  Why keep a counter? Rather than an iterated loop<br><br>so ,  if use a iterated loop:<br><br>for i in range(43):<br>    item = choice( ALIST )<br>
    ALIST.remove( item )<br><br>    if item in already_picked_list:<br>        continue<br><br>    slot.append( item )<br><br><br>For example, if  we picked item from ALIST 43 times, but all picked items are in already_picked_list<br>
What's the slot?   It's a empty list,  not contains item from ALIST.<br><br><b>This is wrong</b><br><br><br><br>> Do you really want to remove an item from the source list? <br><br><b>Yes</b>,   i<b>tems in slot must be unique</b><br>
<br>( This is also a condition, which  I have missing... )<br><br>> and if you don't want duplicates from within a source list, you should remove them when building the source list<br><b><br>As I mentioned , The source list are all unique elements</b><br>
<br><br><br>Your last code. <br>if B ,C ,D are all empty,  result's elements are all from A,  A's probability is 100% ?<br><br>I Know ,  this problem should treated as two situation:<br><br>If the four list has not enough elements,   There are no way to ensure the probability requirements.<br>
If they has enough elements,  Your solution is a good way.<br>