How can I generate a random number in Java using different distributions within a range(0-99).
I know the standard Java.util.Random getNextInt() uses Uniform and PRNG. How would I use nextGaussian? But how would I generate the rest? The problem is that they need to be within a specified range(0-99), and the Random lib doesn't have nextPossion, nextExponential, nextGeometric etc?
Thanks for your time.
The uncommons maths library has a bunch of tools for generating numbers from various distributions. From the website: "can be used to generate values from Uniform, Normal, Binomial, Poisson and Exponential distributions."
It also has implementations of Random
that are significantly better (for various flavours of "better") than what ships with the JDK.