tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 
 Tools and Libs > Uncommons Maths > AES Counter Random Number Generator

AES Counter Random Number Generator 

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 AESCounterRNG class.

File Name  :  
com/bethecoder/tutorials/uncommons/AESCounterRNGTest.java 
Author  :  Sudhakar KV
Email  :  kvenkatasudhakar@gmail.com
   
package com.bethecoder.tutorials.uncommons;

import java.security.GeneralSecurityException;
import java.util.Arrays;

import org.uncommons.maths.random.AESCounterRNG;

public class AESCounterRNGTest {

  /**
   @param args
   @throws GeneralSecurityException 
   */
  public static void main(String[] argsthrows GeneralSecurityException {

    AESCounterRNG rand = new AESCounterRNG();
    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());
  }

}
   

It gives the following output,
[-114, -42, -32, 56, 60, 106, -89, -33, 14, -127, 85, -16, -117, 120, -14, 33]
-1381989140
0.47411922556365715
0.7967618308662422
false


                    Print

   



Books Recommendation

 
 
bl  br