title: Fastest Way to generate 1,000,000+ random numbers in python
body: <p>I am currently writing an app in python that needs to generate large amount of random numbers, FAST. Currently I have a scheme going that uses numpy to generate all of the numbers in a giant batch (about ~500,000 at a time). While this seems to be faster than python's implementation. I still need it to go faster. Any ideas? I'm open to writing it in C and embedding it in the program or doing w/e it takes.</p>
  
  <p>Constraints on the random numbers:</p>
  
  <ul>
  <li>A Set of 7 numbers that can all have different bounds:
  
  <ul>
  <li>eg: [0-X1, 0-X2, 0-X3, 0-X4, 0-X5, 0-X6, 0-X7]</li>
  <li>Currently I am generating a list of 7 numbers with random values from [0-1) then multiplying by [X1..X7]</li>
  </ul></li>
  <li>A Set of 13 numbers that all add up to 1
  
  <ul>
  <li>Currently just generating 13 numbers then dividing by their sum</li>
  </ul></li>
  </ul>
  
  <p>Any ideas? Would pre calculating these numbers and storing them in a file make this faster?</p>
  
  <p>Thanks!</p>