Let's say I have a set of probabilities in a numpy array:

[0.25, 0.12.5, 0.125, 0.50]

And I want to generate N one-hot encoded outcomes, proportional to each probability:

[0, 0, 0, 1] should be the outcome 50% of the time
[0, 0, 1, 0] should be the outcome 12.5% of the time

and so on.

I could write something to do these one-by-one, but I need several million results so backending it with numpy would be ideal.