title: Efficiently generating synthetic data from a numpy array
body: <p>Let's say I have a set of probabilities in a numpy array:</p>
  <p>[0.25, 0.12.5, 0.125, 0.50]</p>
  <p>And I want to generate N one-hot encoded outcomes, proportional to each probability:</p>
  <p>[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</p>
  <p>and so on.</p>
  <p>I could write something to do these one-by-one, but I need several million results so backending it with numpy would be ideal.</p>