How to Generate Random Numbers and Session Identifiers in Java

Lets see How to generate random number in java and also we can learn.Random numbers in Java can be generated using either java.util.Random , ThreadLocalRandom class or by using Math.random() method. ThreadLocalRandom is only available from Java 7.

Using java.util.Random

How to generate Random Alpha Numeric String or Session Identifiers.

  Here I am going to use SecureRandom class.Note that SecureRandom objects are expensive to initialize, so you’ll want to keep one around and reuse it.

If you know some more methods to generate random numbers,please use the below comment section to mention the same.

 

About mohan

This is Mohan Jayapalan author of TechPages Blog.I am a part time blogger and Currently working for private Software Concern.

Speak Your Mind

*

© Copyright 2010-2016 www.techpages.org · All Rights Reserved · Powered by WordPress ·