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 CellularAutomatonRNG class.
package com.bethecoder.tutorials.uncommons; import java.util.Arrays; import org.uncommons.maths.random.CellularAutomatonRNG; public class CellularAutomatonRNGTest { /** * @param args */ public static void main(String[] args) { CellularAutomatonRNG rand = new CellularAutomatonRNG(); 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()); } }
[-46, 53, -124, -19] 446193669 0.3435926749266014 -0.6608935424814646 true