This code is to randomize an array with a specific proportion
a0 = np.full((17),0)
a1 = np.full((30),1)
a2 = np.full((38),2)
a3 = np.full((15),3)
options = np.concatenate((a0,a1,a2,a3))
np.random.shuffle(options)
it works as expected generating [a0, a1, a2, a3] with the specific proportion [17%, 30%, 38%, 15%]
However, it becomes ugly when the number of "ax" grow large, like [a0, a1, ... , a999] with [1%, 5%, ... , .2%]
Does Python or NumPy have API to do that work?