title: Generate random vectors with a given (numerical) distribution matrix
body: <p>I'm trying to come up with a fast and smart way of generating random vectors from a distribution matrix, much like what is being discussed here:
  <a href="https://stackoverflow.com/questions/4265988/generate-random-numbers-with-a-given-numerical-distribution">Generate random numbers with a given (numerical) distribution</a></p>
  <p>But the key difference is that I have a distribution matrix, rather than just a single vector.</p>
  <p>Now obviously I could just create a for loop and loop over each vector in my matrix, but that doesn't seem very pythonic, or fast, so I'm kinda hoping that there is a better way of doing it.</p>
  <p>To give a quick example of what I want to do:
  Given a one-probability matrix</p>
  <pre><code>p = [[0.2, 0.4, 0.4],[0.1, 0.7, 0.2],[0.44, 0.5, 0.06],...]
  </code></pre>
  <p>I wish to draw elements, where each element gets selected with the probability in the probability matrix. (Essentially I want to generate a one-hot encoding from my one-probability matrix).
  Which could for instance look like this given the above probabilities:</p>
  <pre><code>t = [2,1,2,...]
  </code></pre>
  <p>I need to do this for long sequences, and I need to do it millions of times, but only 1 time for each sequence each time. (Data augmentation for deep learning)</p>
  <p>Does anyone have a good way of doing this?</p>