title: Algorithm to generate Poisson and binomial random numbers?
body: <p>i've been looking around, but i'm not sure how to do it.</p>
  
  <p>i've found <a href="http://rkb.home.cern.ch/rkb/AN16pp/node208.html" rel="noreferrer">this page</a> which, in the last paragraph, says:</p>
  
  <p><i>A simple generator for random numbers taken from a Poisson distribution is obtained using this simple recipe: if x<sub>1</sub>, x<sub>2</sub>, ... is a sequence of random numbers with uniform distribution between zero and one, k is the first integer for which the product x<sub>1</sub> · x<sub>2</sub> · ... · x<sub>k+1</sub> &lt; e<sup>-λ</sup></i></p>
  
  <p>i've found <a href="http://www.mathworks.com/access/helpdesk/help/toolbox/stats/bqttfc1.html" rel="noreferrer">another page</a> describing how to generate binomial numbers, but i think it is using an approximation of poisson generation, which doesn't help me.</p>
  
  <p><i>For example, consider binomial random numbers. A binomial random number is the number of heads in N tosses of a coin with probability p of a heads on any single toss. If you generate N uniform random numbers on the interval (0,1) and count the number less than p, then the count is a binomial random number with parameters N and p.</i></p>
  
  <p>i know there are libraries to do it, but i can't use them, only the standard uniform generators provided by the language (java, in this case).</p>