From what I understand, the standard generator is for the Normal Distribution. I have to generate random numbers according to the Normal, Uniform and Poisson Distributions, but I can't seem to find a class for the last 2.
I have to generate them in the range of 0 - 999999.
The standard Java RNG (java.util.Random), and its subclasses such as java.security.SecureRandom, already generate uniformly distributed values.
They also have a method, nextGaussian, that returns normally-distributed values. By default, the distribution has mean of zero and standard deviation of 1 but this is trivially tweaked. Just multiply by the required s.d. and add the required mean. So, for example, if you wanted normally-distributed values with a mean of 6 and standard deviation of 2.5, you'd do this:
The Poisson distribution is not explicitly supported, but you can fake it by doing the same as Tom's Python code.
Alternatively, you may be interested in my Uncommons Maths library, which provides utility classes for Normal, Poisson and other distributions.
As David has pointed out, the supplied pseudo-random number generator uses the Uniform distribution.
For the other two, I would use the Cern Colt library functions:
These library functions easily allow you to find a random number taken from each distribution, rather than giving you a probability density function or cumulative density function and expecting you to derive the number yourself (which seems to be the Apache Commons-Math approach):
Also, bear in mind that the Poisson distribution P(λ) for large λ can be approximated very well by the normal distribution N(λ, sqrt(λ)).
Let me preface all this by the fact that none of this is truly random, I am talking about pseudo random number generators.
Let me also say that I have never had to do this for production quality code. I have done this for a hw assignment though, in Python. I simulated Poisson random variables.
The way that I did it made use of the following facts:
In particular, you can use the fact that: if X1, ..., Xn are independent standard exponential random variables, then Z = min(k : X1 + ... + Xk < λ) - 1 is Poisson(λ).
So, with that, I wrote the following code in python to generate Poisson values:
Example usage of the class is:
I posted this here because it is good to know that these kinds of relationships exist, and this inverse transform method gives you a general way to deal with generating random values following a particular continuous distribution.
Actually, the standard generator is for the uniform distribution. The basic random number generator in any language/library will always (in all cases I know of) use the uniform distribution because that's what comes out of all the popular pseudorandom number generator algorithms - basically, uniform random numbers are the easiest.
I see Eddie already pointed you to a link for other distributions so I'll skip writing the rest of this...