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 JavaRNG class.
package com.bethecoder.tutorials.uncommons; import java.util.Arrays; import org.uncommons.maths.random.JavaRNG; public class JavaRNGTest { /** * @param args */ public static void main(String[] args) { JavaRNG rand = new JavaRNG(); System.out.println(Arrays.toString(rand.getSeed())); System.out.println(rand.nextInt()); System.out.println(rand.nextDouble()); System.out.println(rand.nextGaussian()); System.out.println(rand.nextBoolean()); } }
[78, -5, 86, 69, 0, -18, 73, -18] 1740698033 0.692730311461731 1.1374133574192549 false