Uncommons Maths is a java library with nice math utilities and random number generators. This requires the library uncommons-maths-1.2.2.jar to be in classpath. The following example shows using ExponentialGenerator class.
package com.bethecoder.tutorials.uncommons; import java.util.Random; import org.uncommons.maths.random.ExponentialGenerator; public class ExponentialGeneratorTest { /** * @param args */ public static void main(String[] args) { ExponentialGenerator rand = new ExponentialGenerator(0.000786d, new Random()); for (int i = 0 ; i < 10 ; i ++) { System.out.println(rand.nextValue()); } } }
1272.7026873596476 412.75678391244475 149.81657706367767 918.101609472915 22.300243125220817 3212.078407028688 1994.1502525133972 930.1557911515964 801.1398892359788 2594.1764046935727