Thursday 20 September 2012

Random Key Generator

Sometimes we do need some sort of random key , say for example :

* Sending some unique password / key for one time authentication
* Generating some random user name
* Generating one time password
* validate email / mobile number

and so on ...

So why to bother every time writing some code for generating random number. Here is solution :

Download Random Generator Jar

Just include this jar file and use utility functions :

Example :


package testing;

import com.affiance.yim.gaurav.random.RandomKeyGenerator;

public class Testing {
public static void main(String[] s) {
System.out.println(RandomKeyGenerator.getRandomAlbhabeticKey(10));
System.out.println(RandomKeyGenerator.getRandomAlphaNumericKey(10));
System.out.println(RandomKeyGenerator.getRandomNumericKey(10));
}
}


Functions take a parameter, length of key you want to generate.

Enjoy Coding !















keywords for SEO  : java j2ee random secret unique key password alphanumeric alphabetic numeric length