List of usage examples for org.apache.wicket.util.crypt StringUtils newStringUsAscii
public static String newStringUsAscii(final byte[] bytes)
String
by decoding the specified array of bytes using the US-ASCII charset. From source file:sf.wicklet.ext.application.WickletSupport.java
License:Apache License
public static String randomString(final Random random, final int min, final int max) { final byte[] a = new byte[max]; random.nextBytes(a);// ww w . ja v a 2 s. c o m int len = min; if (max != min) { len += random.nextInt(max - min + 1); } String ret = StringUtils.newStringUsAscii(Base64.encodeBase64(a, false, true)); if (ret.length() != len) { ret = ret.substring(0, len); } return ret; }