Randomly Generating Combinations From Variable Weights
问题 VERY IMPORTANT EDIT: All A i are unique . The Question I have a list A of n unique objects. Each object A i has a variable percentage P i . I want to create an algorithm that generates a new list B of k objects ( k < n / 2 and in most cases k is significantly less than n / 2 . E.g. n=231 , k=21 ). List B should have no duplicates and will be populated with objects originating from list A with the following restriction: The probability that an object A i appears in B is P i . What I Have Tried