Here you can find the source of randomPassword()
public static String randomPassword()
//package com.java2s; import java.util.*; public class Main { /** Module name */ private static final String MODULE_NAME = "FusionUtils."; /**//from w w w.j a v a 2 s .co m * Generate a random password, used when a password validation fails to ensure that the user doesn't get saved with * some sort of invalid (and thus insecure) password. Also used to initialize passwords. * * @return String */ public static String randomPassword() { String methodName = MODULE_NAME + "randomPassword()"; String retval = ""; char[] pwd = new char[12]; Random randomGuy = new Random(); //We only want ASCII values 40-126 for (int i = 0; i < pwd.length; i++) { pwd[i] = (char) (randomGuy.nextInt(86) + 40); } retval = new String(pwd); //Logger.log( methodName + " generated: " + retval, Logger.INFO ); return retval; } }