Import java. util. ArrayList; Import java. util. List; Public class GeneratePswd { @ SuppressWarnings ({"unchecked", "unchecked "}) Public static void main (String [] args ){ StringBuffer buf = new StringBuffer ("a, B, c, d, e, f, g, h, I, g, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z "); Buf. append (", A, B, C, D, E, F, G, H, I, G, K, L, M, N, O, P, Q, R, s, T, U, V, W, X, Y, Z "); Buf. append (",~, @, #, $, %, ^, &, *, (,), _, +, | ,',."); Buf. append (", 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 "); String [] arr = buf. toString (). split (","); List pswdList = new ArrayList ();
For (int I = 0; I <50; I ++ ){ PswdList. add (getPswd (arr )); }
For (int I = 0; I <pswdList. size (); I ++ ){ System. out. println (pswdList. get (I )); } } Public static String getPswd (String [] arr ){ StringBuffer B = new StringBuffer (); Java. util. Random r; Int k; For (int I = 0; I <15; I ++ ){ R = new java. util. Random (); K = r. nextInt (); B. append (String. valueOf (arr [Math. abs (k % 76)]); }
Return B. toString (); } } |