I have a sorted list that I need to sample from. I want to favor the items towards each end of the list. In other words, I want to sample from the list using a negated normal function such that the first and last entries of the list are chosen more frequently than items in the middle of the list. I tried this:
slots = np.floor(np.random.normal(scale=len(children)//2, size=max_children)) - max_children//2
return children[slots]
However, it returns numbers that are out of range. It also returns duplicate numbers. What can I do better?