I needed to write a weighted version of random.choice (each element in the list has a different probability for being selected). This is what I came up with:
A very basic and easy approach for a weighted choice is the following:
np.random.choice(['A', 'B', 'C'], p=[0.3, 0.4, 0.3])