Today i was looking for a way to make a random generated password, and i made some search and the best thing i found was the method below.
but you have to add the library that contains the RandomStringUtils class to the project you are working on to be able to import it, the libraries that contain this class are called (JRF Client, JAX-RS Jersey Jackson (Bundled))
Source:
http://stackoverflow.com/questions/41107/how-to-generate-a-random-alpha-numeric-string
if you want to generate a random password (for forgot password scenario, and email this random password to the user), use the following class RandomStringUtils
this is the code to generate the password,
RandomStringUtils.randomAlphanumeric(20).toUpperCase();
20 = number of random chars in the generated password,
you can change this number based on how many chars you want
in your random generated password.
Source:
http://stackoverflow.com/questions/41107/how-to-generate-a-random-alpha-numeric-string
No comments:
Post a Comment